skip to main | skip to sidebar

in a ASP.Net 2.0 web Application, to get a connection string from Web.config, you would write:
ConfigurationManager.ConnectionStrings("DB").ConnectionString

trying to do the same in a Windows application, would give you the error :
Name 'ConfigurationManager' is not declared
even you did import "System.Configuration"...

well, after searching i found that you need to add reference to "System.Configuration.dll" : under Project > Add refrence > .Net > select System.Configuration

6 comments

  1. Anonymous // November 16, 2009 5:03:00 PM GMT  

    Your suggestion worked the firs time as described. Thank you, Robert Watson

  2. katia // February 17, 2010 9:49:00 AM GMT  

    Thank you soooooooo much !!!!

  3. Anonymous // June 29, 2010 8:01:00 AM GMT  

    That was VERY helpful, after an hour of searching why it seemed to work in the immediate window but not in code! Thanks

  4. Anonymous // September 4, 2010 8:21:00 AM GMT  

    Excellent!!!!This solution worked for me too..

  5. Anonymous // August 5, 2011 5:24:00 AM GMT  

    Worked like a charm. Thak You.

  6. Pants // April 24, 2012 10:37:00 PM GMT  

    Rarely is internet help so concise or easy to implement! Thanks a bunch :)

Post a Comment

Thank you for taking the time to comment..
* If you have a tech issue with one of my plugins, you may email me on mike[at]moretechtips.net

Mike

Mike MoreWeb developer, jQuery plugin author, social media fan and Technology Blogger.
My favorite topics are: jQuery , Javascript , ASP.Net , Twitter , Google..
<connect with="me"> </connect>

Subscribe by email

Enter your email address:

or via RSS