Still Cannot Use ConfigurationManager Class in Code

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top