aspx Tutorial

.NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services, .NET articles, Sharepoint 2010, visual studio 2010,Aamir Hasan,IT, Building Your First Web Application Project
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Thursday, June 16, 2011 Total Views:  

In this example, you will learn how to write a connection string in Web.Config, Writing a connection string in Web.Config makes you easy to change the database name, server name, username and password of database login. Doing this, you don't need to change a connection string setting in all pages if your Web project has a large number of pages.

Here's an example

       <connectionStrings>

              <!--Attach a database file which is placed inside the data directory of Web Application-->

              <add name="ConnectionString_1"

                      connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;

                                        User Instance=true" providerName="System.Data.SqlClient"/>

 

              <!--Attach a database file which is placed inside the data directory of Web Application-->

              <add name="ConnectionString_2"

                      connectionString="Data Source=[SERVER_NAME];AttachDbFilename=[DATABASE_NAME AND PATH e.g c:\app_data\aspxtutorial.mdf];

                                        Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient"/>

 

              <!--Relative path of database in side connection string-->

              <add name="ConnectionString_3"

                      connectionString="server=[SERVER_NAME];database=[DATABASE_NAME];uid=[USER ID];password=[PASSWORD];

                                        Connect Timeout=20; Max Pool Size=2000  " />

       </connectionStrings>

Protected by Copyscape Online Plagiarism Tool

Comments (2) -

 Florida beach wedding
Florida beach wedding United States
7/9/2012 5:18:25 AM #

This is very nice post.

Great Barcode Generator
Great Barcode Generator United States
7/30/2012 2:25:00 AM #

in it string connection function is shown...the working of it is clearly based on the member values and class function that are been declared before...,visit

http://www.greatbarcodegenerator.com/

Adam Gainor
Adam Gainor United States
6/3/2014 2:17:39 AM #

Aw, this was a really nice post. In idea I would like to put in writing like this additionally � taking time and actual effort to make a very good article� but what can I say� I procrastinate alot and by no means seem to get something done.More For xxx video http://www.uxxx.me/

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5