Storing and Fetching Database Connection Strings from App.config/Web.config File in .NET

We have shifted..

https://programmingpalace.wordpress.com/ is now http://thetechstory.com/

Find this Tutorial in the given link.

http://thetechstory.com/2012/09/18/storing-and-fetching-database-connection-strings-from-app-configweb-config-file-in-net/

Advertisements

3 thoughts on “Storing and Fetching Database Connection Strings from App.config/Web.config File in .NET

  1. Pingback: Connecting Multiple Databases in .NET using C# – Part 1 Introduction | Programming Palace

  2. Please Don’t serve wrong information.you Could not use configurationManager class in Windows application.please improve it.

    public static ConnectionStringSettings conSettings = ConfigurationManager.ConnectionStrings[“SqlServer”];
    2

    3
    public static string connString = conSettings.ConnectionString;
    4

    5
    SqlConnection conn = new SqlConnection(connString);

    • I have used that in a application and it works fine. You try out with an Windows Forms Application. It should work. I use Visual Studio 2010, .NET Framework 4.0 for my project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s