latest Post

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,

  1. protected void BinddataTable()  
  2. {  
  3.     SqlConnection con = new SqlConnection("your database connection string");  
  4.     con.Open();  
  5.     SqlCommand cmd = new SqlCommand("Write your query or procedure", con);  
  6.     SqlDataAdapter da = new SqlDataAdapter(cmd);  
  7.     DataTable dt = new DataTable();  
  8.     da.Fill(dt);  
  9.     grid.DataSource = dt;  
  10.     grid.DataBind();  
  11. }

About Mallikarjun A

Mallikarjun A
Recommended Posts × +

0 comments:

Post a Comment