What is DataTable in ADO.NET?
- DataTable represents a single table in a database.
- In this show row and column.
- DataSet is a collection of data tables.
- In this store data record.
DataTable representation in .aspx.cs code,
- protected void BinddataTable()
- {
- SqlConnection con = new SqlConnection("your database connection string");
- con.Open();
- SqlCommand cmd = new SqlCommand("Write your query or procedure", con);
- SqlDataAdapter da = new SqlDataAdapter(cmd);
- DataTable dt = new DataTable();
- da.Fill(dt);
- grid.DataSource = dt;
- grid.DataBind();
- }
0 comments:
Post a Comment