Connection String in app.config

Discussion in 'ASP .Net' started by Fresno Bob, Jan 24, 2008.

  1. Fresno Bob

    Fresno Bob Guest

    I am creating data access layer with strongly typed datasets in a class
    library included in a Website Project. My website uses a web.config file to
    store the connection string but the class uses the app.config.

    When I deploy my application is there any way of changing the app config
    without recompiling the application. I have never done this before so I am
    not sure how it works.

    Regards, Chris.
     
    Fresno Bob, Jan 24, 2008
    #1
    1. Advertising

  2. "Fresno Bob" <> wrote in message
    news:u$...
    >I am creating data access layer with strongly typed datasets in a class
    >library included in a Website Project. My website uses a web.config file to
    >store the connection string but the class uses the app.config.


    What do you mean by "the class uses the app.config"? If you are using
    ConfigurationManager.ConnectionStrings in your class, then it will use the
    config file specified by the application (web.config for a web project, or
    app.config for an application). You don't have to do anything special.
     
    Scott Roberts, Jan 24, 2008
    #2
    1. Advertising

  3. Fresno Bob

    Jeff Dillon Guest

    Use Notepad to change the app.config. It's read at run time

    Jeff

    "Fresno Bob" <> wrote in message
    news:u$...
    >I am creating data access layer with strongly typed datasets in a class
    >library included in a Website Project. My website uses a web.config file to
    >store the connection string but the class uses the app.config.
    >
    > When I deploy my application is there any way of changing the app config
    > without recompiling the application. I have never done this before so I am
    > not sure how it works.
    >
    > Regards, Chris.
    >
     
    Jeff Dillon, Jan 24, 2008
    #3
  4. Fresno Bob

    Fresno Bob Guest

    I have a website website in my solution as well as two class libraries, one
    for my business layer and one for my data access layer. The DAL is made up
    of strongly typed datasets using the app config to get the connection
    string.

    I have added references within my website to the BLL and DAL projects so
    when I compile the project they get added to the bin of the website. I can't
    see a way of changing the app.config whithin my website as it doesn't get
    added the website on compilation. I am sure there must be a way of changing
    it at run time I just can't see how.

    Regards, Chris.



    "Jeff Dillon" <> wrote in message
    news:...
    > Use Notepad to change the app.config. It's read at run time
    >
    > Jeff
    >
    > "Fresno Bob" <> wrote in message
    > news:u$...
    >>I am creating data access layer with strongly typed datasets in a class
    >>library included in a Website Project. My website uses a web.config file
    >>to store the connection string but the class uses the app.config.
    >>
    >> When I deploy my application is there any way of changing the app config
    >> without recompiling the application. I have never done this before so I
    >> am not sure how it works.
    >>
    >> Regards, Chris.
    >>

    >
    >
     
    Fresno Bob, Jan 25, 2008
    #4
  5. Bob,

    What makes you think that the DAL is using app.config to get the connection
    string? Have you tried simply putting the connection string into web.config?


    "Fresno Bob" <> wrote in message
    news:...
    >I have a website website in my solution as well as two class libraries, one
    >for my business layer and one for my data access layer. The DAL is made up
    >of strongly typed datasets using the app config to get the connection
    >string.
    >
    > I have added references within my website to the BLL and DAL projects so
    > when I compile the project they get added to the bin of the website. I
    > can't see a way of changing the app.config whithin my website as it
    > doesn't get added the website on compilation. I am sure there must be a
    > way of changing it at run time I just can't see how.
     
    Scott Roberts, Jan 25, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ad
    Replies:
    1
    Views:
    3,762
    Christopher Reed
    Mar 30, 2006
  2. Replies:
    4
    Views:
    10,348
    Kevin Spencer
    Apr 5, 2006
  3. CSharpner
    Replies:
    0
    Views:
    1,141
    CSharpner
    Apr 9, 2007
  4. Replies:
    3
    Views:
    866
    Samuel R. Neff
    Aug 3, 2007
  5. vbjohn
    Replies:
    0
    Views:
    555
    vbjohn
    Jan 29, 2008
Loading...

Share This Page