SqlConnection con = new SqlConnection("trusted_connection=yes;database=northwind;server=localhost");
SqlCommand cmd = new SqlCommand("select * from customers", con);
try
{
con.Open();
GridView1.DataSource = cmd.ExecuteReader();
GridView1.DataBind();
}
finally
{
con.Close();
}
No comments:
Post a Comment