First of all you have to create sql
connection with the database...
For this see the following link
now use the following code for gridview bind in button click event...
protected void Button1_Click(object
sender, EventArgs e)
{
{
con.open();
SqlDataAdapter adp=new SqlDataAdapter("Select * from Emp",con);
DataTable dt=new DataTable();
adp.Fill(dt);
GridView1.DataSource=dt;
GridView1.Databind();
}
0 comments:
Post a Comment