In this article i have explain how to load data reader result set to data table. We have a result set that are retrieve from database now i want to load these result set to data table. for doing this we are used to following code in c#.
string sql="select * from tbldataTable";
SqlCommand cmd = new SqlCommand(sql,conn);
SqlDataReader rdr = cmd.ExecuteReader();
DataTable dt = new DataTable();
if (rdr.HasRows)
dt.Load(rdr);
The above code are convert the result set to data table .
string sql="select * from tbldataTable";
SqlCommand cmd = new SqlCommand(sql,conn);
SqlDataReader rdr = cmd.ExecuteReader();
DataTable dt = new DataTable();
if (rdr.HasRows)
dt.Load(rdr);
The above code are convert the result set to data table .
No comments:
Post a Comment