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
How can we serialize the dataset object?
What are all components of ADO.Net data provider?
How to work with disconnected data - the dataset and sqldataadapter?
What are basic methods of dataadapter?
How to find the given query is optimised one or not?
What does ado stand for?
Some important instruction regarding ADO.NET connection string ?
how we can fire event in databound coulm in datagfrid withot using button?
What is ado.net in vb net?
What is datatable in ado.net?
Explain the difference between an ado.net dataset and an ado recordset?
How can we check that some changes have been made to dataset since it was loaded?
Explain what are acid properties?
How does ado.net work?
Does dapper use ado.net?