What is the DataReader in ADO.Net?
- DataReader holds only one table at a time.
- It only provides read only access mode and cannot write data.
- It is not required local storage to data store.
- Holds one row at a time.
- Uses less memory.
- DataReader do not maintain relation.
- protected void Bind()
- {
- SqlConnection con = new SqlConnection("your database connection string ");
- con.Open();
- SqlCommand cmd = new SqlCommand("Write your query or procedure ", con);
- SqlDataReader dr = cmd.ExecuteReader();
- grid.DataSource = dr;
- grid.DataBind();
- }
0 comments:
Post a Comment