First you will have to create a class file under App_Code Folder.
add SqlClient namespace as given below-
using System.Data.SqlClient;
public class connection
{
public SqlConnection con = new SqlConnection();
public SqlCommand cmd = new SqlCommand();
public SqlDataAdapter adp = new SqlDataAdapter();
public SqlCommandBuilder scb = new SqlCommandBuilder();
public DataSet ds = new DataSet();
public DataRow dr;
public connection()
{
con.ConnectionString = "Data Source=.\\sqlexpress;User Id=sa;Password=pass; Database=testdb";
cmd.Connection = con;
adp.SelectCommand = cmd;
}
No comments:
Post a Comment