Friday, January 25, 2008

Syntax for Connection String in Web.Config

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<connectionStrings>
<
add name= "Con" connectionString= "Server=.; initial catalog=my_database_in; uid=sa; pwd=sa" />

connectionStrings>

======================================================
Now Add the Code Line Below in the ".aspx.cs" file at class level

using System.Data.SqlClient;

protected SqlConnection con = new SqlConnection( System.Configuration.ConfigurationManager.AppSettings ["CON"] );




-
ShriKrishna Bhardwaj , With ASP.Net, SQL Server, Javascript

No comments: