Step 1 : Add Namspace "using System.Data.SqlClient;"
Step 2 : Make Sql connection.
Write this code to create Sql connection.
SqlConnection con = new SqlConnection("Server=You server name or comp name;Database=Yourdatabasename;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("Write your sql query here eg. select * from Table name");
con.Open();
DataSet ds = new DataSet(cmd,con);
SqlDataAdapter da = new SqlDataAdapter();
da.Fill(ds);
con.Close();
Step 2 : Make Sql connection.
Write this code to create Sql connection.
SqlConnection con = new SqlConnection("Server=You server name or comp name;Database=Yourdatabasename;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("Write your sql query here eg. select * from Table name");
con.Open();
DataSet ds = new DataSet(cmd,con);
SqlDataAdapter da = new SqlDataAdapter();
da.Fill(ds);
con.Close();