Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the difference between executenonquery () and executescalar ()?

879


What are two important objects of ADO.Net?

963


How does entity framework work?

851


What is the provider being used to access oracle database?

928


What is ole2 format?

847


What is csdl entity framework?

969


How to add an aggregate column?

937


Why edit is not possible in repeater?

891


How to add a javaScript function in a datagrid?

1053


What are the disadvantages of using datalist?

967


Which parameter of ConnectionString is used to specify the name of the database?

980


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?

912


Explain all the classes those are used for database connections between sql server and asp.net?

949


How do you update database through dataset?

933


What are two types of transaction supported by ado.net?

936