Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
When I try to write ConfigurationManager.Appsettings in C# windows application it is not recogonizing it as a member of system.configuration namespace what could be the problem?

The intellisense is not recogonising the Configuration.Appsettings statement itself.
Posted
Comments
BillWoodruff 19-Dec-13 3:09am    
Don't you mean: ConfigurationSettings.Appsettings ?

Hi Leo,
Please try to add System.Configuration.dll in the reference folder.
 
Share this answer
 
ConfigurationManager.AppSettings is actually a property, so you need to use square brackets.

here's what you need to do:

C#
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
 
Share this answer
 
v2
Comments
BillWoodruff 19-Dec-13 2:42am    
+5 If the Class Name is changed to ConfigurationSettings.AppSettings, your answer is a valid solution to the OP's problem. fyi: ConfigurationSettings.AppSettings is an instance of the NameValueCollection Class which "Represents a collection of associated String keys and String values that can be accessed either with the key or with the index."
bluesathish 19-Dec-13 4:07am    
Yes Thanks @Bill.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900