Can dataReader hold data from multiple tables?

Submitted by: Administrator
data reader can hold data from multiple tables and datareader can hold more than one table.



string query="select * from employee; select * from student";

sqlcommand cmd=new sqlcommand(query, connection);

sqldatareader dr=cmd.executeReader();

if(dr.hasrows)

{

dr.read();

gridview1.DataSource=dr;

gridview1.Databind();

if(dr.nextresult)

{

gridview2.datasource=dr;

gridview2.databind();

}

}

dr.colse();

connection.close();
Submitted by: Administrator

Read Online ADO.NET Job Interview Questions And Answers