Connection String in app.config

Connection String in app.config

am 24.01.2008 21:26:42 von DFS

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.

Re: Connection String in app.config

am 24.01.2008 21:53:00 von Scott Roberts

"Fresno Bob" wrote in message
news:u$IKGesXIHA.6044@TK2MSFTNGP05.phx.gbl...
>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.

Re: Connection String in app.config

am 24.01.2008 22:32:08 von Jeff Dillon

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

Jeff

"Fresno Bob" wrote in message
news:u$IKGesXIHA.6044@TK2MSFTNGP05.phx.gbl...
>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.
>

Re: Connection String in app.config

am 25.01.2008 08:58:43 von DFS

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:eI0ENCtXIHA.1532@TK2MSFTNGP04.phx.gbl...
> Use Notepad to change the app.config. It's read at run time
>
> Jeff
>
> "Fresno Bob" wrote in message
> news:u$IKGesXIHA.6044@TK2MSFTNGP05.phx.gbl...
>>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.
>>
>
>

Re: Connection String in app.config

am 25.01.2008 16:41:24 von Scott Roberts

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:OEXVzgyXIHA.3556@TK2MSFTNGP02.phx.gbl...
>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.