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


November 11, 2007 10:19:48 #2
 Ravindra Thakur   Member Since: Visitor    Total Comments: N/A 

RE: retrieve two tables of data at a time by using dat...
 

Yes , it is posible to retreve two tables in datareader.


If we pass 2 select command in a string and set that string to commandtext of command object. and execute reader.


ex:
string str="Select * from A;Select * from B";
cmd.commandtext=str;
dr=cmd.executereader();

     

 

Back To Question