Basic Code for populating the Gridview in ASP.NET
Using C#
SqlConnection con = new SqlConnection("your connection string comeshere");
SqlDataAdapter da = new SqlDataAdapter("select firstname,lastname from employees", con); DataSet ds= new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
Using VB.NET
Dim con as SqlConnection =new SqlConnection ("your connection string comeshere")
dim da as SqlDataAdapter =new SqlDataAdapter ("select firstname,lastname from employees", con)
dim ds as new DataSet()
da.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment