What is the difference between a Dataset and DataReader?
Can dataReader hold data from multiple tables?
Answer Posted / karna
data set a collection of datatables and we can edit the
data in the datatables and the same can be persisted to
databae using adapter in the disconnected maner by using
commandbuilder or insert,update,select command.
datareader is just the container for data,its readonly and
forwardonly curosr.this follows connected architecture,that
means when we are reading data from datareader at that time
connection should be kept open.
data reader can hold data from multiple tables and
datareader can hold more than one table.
Example:
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();
if anybody have any doubts,mail to me on karun84@gmail.com
Is This Answer Correct ? | 14 Yes | 5 No |
Post New Answer View All Answers
What is an ado connection?
Which is the feature of ado.net?
Why is ADO.NET serialization slower than ADO ?
What is dataadapter in ado.net?
How can I retrieve two tables of data at a time by using data reader?
What are the major challenges in accessing data from a database?
What is an ADO.Net?
What is data relation in ado.net?
Can we connect two dataadapters to same data source using single connection at same time?
What do you mean by performing asynchronous operation using command object?
What is ado.net full form?
What is connected architecture in ado.net?
How can we load multiple tables in a dataset?
What are ado.net objects?
What is ado control?