G
Guest
Hi all,
I have a solution with 4 projects: a class library, a windows app, a windows
service, and an installer project. The class library handles all
communication with the database and its classes are used by both the
application and the service. I have stored the database connection string in
an app.config file located in the class library project.
Everything was working fine on my dev box, but when I migrated to the QA
box, I started getting a "connection string not initialized" error. When I
hard code the connection string in each of the class files, everything works
fine, which leads me to believe that the problem is that the app.config file
is not being read. The code I'm using in each of my class files is:
SqlConnection conn = new
SqlConnection(ConfigurationSettngs.AppSettings["whitney"]);
Questions: since the class library is the only project that connects to the
database, is it the only project that should have an app.config file with the
connection string? Do I need to explicitly add the app.config file to my
installer project? What could I be doing wrong?
Thanks in advance for your help!
Brian
I have a solution with 4 projects: a class library, a windows app, a windows
service, and an installer project. The class library handles all
communication with the database and its classes are used by both the
application and the service. I have stored the database connection string in
an app.config file located in the class library project.
Everything was working fine on my dev box, but when I migrated to the QA
box, I started getting a "connection string not initialized" error. When I
hard code the connection string in each of the class files, everything works
fine, which leads me to believe that the problem is that the app.config file
is not being read. The code I'm using in each of my class files is:
SqlConnection conn = new
SqlConnection(ConfigurationSettngs.AppSettings["whitney"]);
Questions: since the class library is the only project that connects to the
database, is it the only project that should have an app.config file with the
connection string? Do I need to explicitly add the app.config file to my
installer project? What could I be doing wrong?
Thanks in advance for your help!
Brian