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
Is datareader faster than datatable?
What are the different row versions available in table?
What is ole in vb?
Is ado.net an orm?
What are all the different methods under sqlcommand?
What is sqldatasource?
What are the methods of XML dataset object?
How to add an aggregate column?
How can you identify whether or not any changes are made to the DataSet object since it was last loaded?
What is the difference between Data adaptor and Data set?
Explain sqlconnection object?
Explain how to bind the controls(best practice) comboboxes to the data in the dataset?
What is the difference between Command and CommandBuilder object?
How can we load multiple tables in a dataset?
What is the procedure to call a Stored Procedure of Back End in ADO (ActiveX Data Object) and RDO (Remote Data Objects)?