Sunday, September 23, 2018

Create Live Connection String Under Web.config file

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();





No comments:

Post a Comment

GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...