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
Explain advantages of ado.net?
how can implement dropdownlist in particular of dataset when try to update?
What is the return type of executescalar?
What is difference between ado and other data object?
Why do we use sqldataadapter?
What is ole db and odbc?
What is ado.net object model?
What DataReader class do in ADO.NET ?
Explain the different row versions available in table?
differance between ADO vs ADO.Net?
Why ca not we use multiple inheritance and garbage collector paralelly in .net?
How will you differentiate between ADO (ActiveX Data Object) and RDO (Remote Data Objects)?
What are the pre-requisites for connection pooling?
What is microsoft ado?
Give an example that shows how to execute a stored procedure in ado.net?