Connection String in app.config

F

Fresno Bob

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.
 
S

Scott Roberts

Fresno Bob said:
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.
 
F

Fresno Bob

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.
 
S

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top