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 ?

Answers were Sorted based on User's Feedback



can we have multiple datatables in a datareader ?..

Answer / 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

can we have multiple datatables in a datareader ?..

Answer / satya

Yes. We can have multiple data tables in a datareader. You
can read the reuslt with datareader.NextResult method.

Is This Answer Correct ?    46 Yes 8 No

can we have multiple datatables in a datareader ?..

Answer / satya

we can not have multiple dataTables in a datareader but we can
have multiple reuslt Sets in a datareader.

Is This Answer Correct ?    17 Yes 7 No

can we have multiple datatables in a datareader ?..

Answer / ratnam

Yes. We can have multiple data tables in a datareader. You
can read the reuslt with datareader.NextResult method.

Is This Answer Correct ?    11 Yes 2 No

can we have multiple datatables in a datareader ?..

Answer / mayank jain

Yes we can have...
for that datareader have "NextResult" method. by using we
can use the multiple table.

Is This Answer Correct ?    7 Yes 1 No

can we have multiple datatables in a datareader ?..

Answer / sridhar para

we can not have multiple dataTables in a datareader but we
can have multiple reuslt Sets in a datareader.

We can have multiple dataTables in a dataset.

Is This Answer Correct ?    6 Yes 0 No

can we have multiple datatables in a datareader ?..

Answer / eduardo belmonte

Some people get confused.

A datareader can not have any amount of datatables.
Not even one of them.

Datatables exist by themmselves or inside a dataset, but
they are not generated nor filled by a datareader.

A datareader generates "only datarows", it doesn't generate
datatables. Each one of the datarows comply with a
structure as defined by the SELECT sql statement.

That SELECT statement may have columns that belong to one
or more "tables in the database". By example using a JOIN
or something similar. But listen well I said "tables" not
"datatables".

OK my friends?

Is This Answer Correct ?    12 Yes 8 No

can we have multiple datatables in a datareader ?..

Answer / rajesh n s

No multiple datables but multiple tableS from database with
query statement.

Is This Answer Correct ?    5 Yes 1 No

can we have multiple datatables in a datareader ?..

Answer / vivek

we can not have multiple databases in datareader

Is This Answer Correct ?    3 Yes 0 No

can we have multiple datatables in a datareader ?..

Answer / yuri

The question itself is incorrect. A data reader is a stream
of data, while a data table is a fixed structure. Having
said that, a data reader has one or more schema tables which
are of type DataTable. I suppose the correct question would
be: "can one data reader read from multiple SELECT
statements" and the answer to that question is YES.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ADO.NET Interview Questions

can we create synonymn in ms access,sql server,my sql if so explain me with example

0 Answers  


What is concurrency? How will you avoid concurrency when dealing with dataset? (One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will you avoid the problem?)

0 Answers  


What is connected architecture in ado.net?

0 Answers  


What is two way data binding android?

0 Answers  


What is linq and entity framework?

0 Answers  


What are major difference between classic ADO and ADO.NET?

2 Answers  


Describe datareader object of ado.net with example.

0 Answers  


How to retrieve the third table value from the data set?

2 Answers   Network Solutions,


What is a datagrid?

4 Answers  


What are the attirbutes of DataSet?

5 Answers   IBM,


What is openquery?

0 Answers  


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

0 Answers  


Categories