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 difference between datagridview and datagrid control in winforms?
What is aggregating data ?
What is the meaning of executenonquery?
What are the ado.net components?
What is meant by executenonquery?
How to bind the controls(best practice) comboboxes to the data in the dataset?
What are the various methods provided by the DataSet object to generate XML?
What is maximum pool size in ado.net connection string?
Is it possible to edit data in Repeater control?
What are the main differences between classic ado and ado.net?
List the 4 common ado.net namespaces?
What is a string variable?
What is the difference between Optimistic and Pessimistic locking?
Define data adapter?
What are the parameters that control most of connection pooling behaviors?