Open web.config File
<configuration>
<system.web>
</system.web>
<connectionStrings>
<add name="key" connectionString="Data Source=ip/doamin;
Network Library=DBMSSOCN;
Connection Timeout=15;
Packet Size=4096;
Integrated Security=no;
Initial Catalog=databasename;
User ID=userid;
password=password;
Encrypt=no;
Max Pool Size=50000;" />
</connectionStrings>
</configuration>
How to Access inside Aspx Page
using System.Data.SqlClient;
using System.Configuration;
string cs = ConfigurationManager.ConnectionStrings["keyname"].ToString();
cn = new SqlConnection(cs);
cn.Open();
<configuration>
<system.web>
</system.web>
<connectionStrings>
<add name="key" connectionString="Data Source=ip/doamin;
Network Library=DBMSSOCN;
Connection Timeout=15;
Packet Size=4096;
Integrated Security=no;
Initial Catalog=databasename;
User ID=userid;
password=password;
Encrypt=no;
Max Pool Size=50000;" />
</connectionStrings>
</configuration>
How to Access inside Aspx Page
using System.Data.SqlClient;
using System.Configuration;
string cs = ConfigurationManager.ConnectionStrings["keyname"].ToString();
cn = new SqlConnection(cs);
cn.Open();
No comments:
Post a Comment