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

9 comments

  1. Anonymous // November 17, 2009 at 4:03:00 AM GMT+11  

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

  2. katia // February 17, 2010 at 8:49:00 PM GMT+11  

    Thank you soooooooo much !!!!

  3. Anonymous // June 29, 2010 at 6:01:00 PM GMT+10  

    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 at 6:21:00 PM GMT+10  

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

  5. Anonymous // August 5, 2011 at 3:24:00 PM GMT+10  

    Worked like a charm. Thak You.

  6. Pants // April 25, 2012 at 8:37:00 AM GMT+10  

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

  7. Anonymous // August 16, 2012 at 7:46:00 AM GMT+10  

    I owe you a beer!!!!!!

  8. Anonymous // November 27, 2012 at 6:53:00 PM GMT+11  

    Thank you, it worked perfactly fine

  9. Unknown // September 27, 2013 at 3:18:00 PM GMT+10  

    thank you ,that is working......

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
More Tech Tips! | Technology tips on web development

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