Still Cannot Use ConfigurationManager Class in Code

G

Guest

I have noticed a number of entries regarding the use of the
ConfigurationManager class to read connection strings. I writing a class
library that requires a DB connection. I have an app.config file in the
application that contains the connection string. I have set a project
reference to the System.Configuration.dll and I have the "using
System.Configuration" statement in the C# code. I can see the class as
public in the Object Browser with a ConnectionStrings property. Yet I still
cannot use the class in my code; it fails to compile with an error,
"ConfigurationManager does not exist...".

How can I get this to work? Other entries say that it should be working now.

Thanks,
Eagle
 
G

Guest

I modified my code and was able reference the ConfigurationManager in the exe
that references the class library per another entry in this newsgroup. I was
able to successfully retrieve the connection string from the app.config file.
The question now becomes how can I achieve this in the class library. Right
now it seems I need to pass the connection string to the dll in some way from
each component that references the class library. I would really like to
hide this.

Thanks,
Eagle
 

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

Top