GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Microsoft  >  Ado.NET

 Print  |  
Question:  retrieve two tables of data at a time by using data reader

Answer: One interview I faced a Q:
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


August 08, 2008 12:30:36 #9
 ManglaRitu   Member Since: August 2008    Total Comments: 1 

RE: retrieve two tables of data at a time by using data reader
 
This is absolutely true that theoretically you can't access two resultset concurrently using Datareader due to its nature of having the connection state with database and forward only traversing. However, if it is possible to have the data from two tables using some manipulation in the "Select" Query so that the desired resultset is achieved. If one uses Union/Union All, he/she has to be very careful regarding the select phrase in both sub-queries.
     

 

Back To Question