declare connection string in web.config file using asp.net C#

If you are new to .net development and don't know how to declare connection string in web.config then you are at right place to learn a lot. In this article we show how to read write connection string in web.config file in asp.net. Before proceeding to our actual article subject we must know what is web.config? file and what is importance of web.config file in any asp.net application?

What is web.config?
Web.Config file is xml based configuration file which save and hold all main setting of asp.net application. You can declare Compilation Settings , database Connection Strings, page settings, custom error settings, security settings, session state configuration, HttpHandler settings, membership provider setting and much more. You can get more details from CodeProject Famous article Web.config File - ASP.NET

What is Connection String?
When you are working with dynamic website you  must connect your asp.net application with database like mysql, sql server, ms access or any. You must have any bridge which connect each other. Connection String is small working part of ADO.Net which let you declare your database related information to connect with your Database. Connection String have Important information to establish connection with any Database.

Basic Connection string in Web.Config file
<connectionStrings>
   <add name="SQLDbConnection" connectionString="Server=SQlServerName; Database=YouDatabaseName; User Id=userid; password= password" providerName="System.Data.SqlClient" />
 </connectionStrings>
 You can easily fillup appropriate fields in your connectionstring. We will discuss how to get ready-made connectionstring from visual studio server explorer database connection.

Search Terms : connection in C#, db connection in webconfig, write connection in web.config, read write connection string in web.config