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 the difference between executenonquery () and executescalar ()?
What are two important objects of ADO.Net?
How does entity framework work?
What is the provider being used to access oracle database?
What is ole2 format?
What is csdl entity framework?
How to add an aggregate column?
Why edit is not possible in repeater?
How to add a javaScript function in a datagrid?
What are the disadvantages of using datalist?
Which parameter of ConnectionString is used to specify the name of the database?
How can I retrieve two tables of data at a time by using data reader? Data reader read and forward only, how is it possible to get 2 tables of data at a time?
Explain all the classes those are used for database connections between sql server and asp.net?
How do you update database through dataset?
What are two types of transaction supported by ado.net?