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

ADVANCE 2025

 HTML TABLE SCROLL BAR  <style>      .table-container {             width: 100%;             overflow-x: auto; /* Enables horizontal s...