Accessing System.Configuration.ConfigurationManager

M

markasshaw

Hi,
Im still very new in the land of .NET and having problems trying to
access the System.Configuration.ConfigurationManager to read&write
application settings.

I downloaded a sample project with the following code
using System.Configuration
SqlConnection cn = new
SqlConnection(ConfigurationManager.ConnectionStrings["AW"].ConnectionString)

and this works fine.

I created a c# windows application, added the using clause to the
Program.cs file, but when I type, Intellisense does not recognise the
ConfigurationManager, and this produces an error during build phase.
I checked the .net project references for both projects and they both
use
System.Configuration version 2.0.0.0 runtime v2.0.50727 C:\Windows
\Microsoft.net\framework\v2.0.50727\system.configuration.dll

Intellisense on the project that works includes many items under
System.Configuration, but Intellisense on my project only includes
ConfigurationException and ConfigurationSettings.

Can anyone tell me why my project doesnt recognise
System.Configuration.ConfigurationManager?

thanks,
Mark.
 
M

markasshaw

Did you include a using statement?

using System.Configuration;

--
HTH,

Kevin Spencer
Microsoft MVP



Yes, I did. Tried that in both the Program.cs and the Form code, but
no luck with either.
 
M

markasshaw

Yes, I did. Tried that in both the Program.cs and the Form code, but
no luck with either.


Ok I've solved the problem. The project didnt have
System.Configuration in the references! I thought it had been added,
but apparently not.
Thanks for the help anyway.
 

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