ADO.NET Question:
Download Questions PDF

Can dataReader hold data from multiple tables?

Answer:

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();

Download ADO.NET Interview Questions And Answers PDF

Previous QuestionNext Question
I loaded the dataset with a table of 10 records. One of the records is deleted from the backend, How do you check whether all the 10 records were present while updating the
data(Which event and steps) and throw the exception.
What is different between SqlCommand object and Command Behavior Object?