can we have multiple datatables in a datareader ?
Answer Posted / vrsanaidu
Yes, we can have multiple result set means multiple
datatable data in one datareader..., code as below
SqlConnection con = new
SqlConnection(ConfigurationSettings.AppSettings["con"]);
SqlCommand cmd = new SqlCommand("SELECT SiteName FROM
Sites;SELECT SiteCode FROM Sites", con);
cmd.Connection.Open();
SqlDataReader r = cmd.ExecuteReader();
do {
while(r.Read()) {
Response.Write(r.GetString(0) + "<br>");
}
} while (r.NextResult());
r.Close();
con.Close();
cmd = null;
r = null;
con = null;
| Is This Answer Correct ? | 47 Yes | 1 No |
Post New Answer View All Answers
What is typed dataset ?
Explain the different row versions available in table?
What is execute scalar in ado.net?
What are the different ado.net namespaces are available in .net?
What are all the different methods under sqlcommand?
Explain executenonquery?
What is the use of Dataview?
What is microsoft ole db provider for sql server?
How to creating a SqlCommand Object?
Give an example that shows how to execute a stored procedure in ado.net?
Define data access layer?
What is Data view?
How does entity framework work?
Define Execute Scalar?
What is ado.net connection?