What is the difference between a Dataset and DataReader?
Can dataReader hold data from multiple tables?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / naresh
Data reader:
1. It is a read only and forward only data access to data.
2. You can access one table at time.
3. It can't persist the data.
4. It is comes under connected architecture.
5. One of the most advantage is it is much faster than Data
Adapter
Data set:
1. It can access multiple tables at a time.
2. It can persist the data.
3. It is a relational data cache hosted in application
domain during execution.
4. It is a disconnected architecture.
5. It can't define with out data adapter.
Yes.dataReader hold data from multiple tables. The SELECT
statement may have columns that belong to one or more
"tables in the database". By example using a JOIN
or something similar.
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / sandyni
DataSet is a disconnected object and holds the data from
datastore. It can hold the data of more than one table.
where as dataReader is connected architecture which can
rbe used to read the data from the dataset in forward only
fashion. DataReader cannot hold multiple tables of data.
| Is This Answer Correct ? | 1 Yes | 3 No |
i have two textboxes one for user name and another for password . i have a table name compare(which contains name,passwod etc.,)my doubt is how compare username textbox with name column and how compare password textbox with passwod column. i want the code
differance between ADO vs ADO.Net?
What is Dataset Object?
What is microsoft ole db provider for sql server?
i want 2 pass values(enterd in textbox)to table in sql server without using stored procedure in c#.plz tell me code with an example.
What is typed dataset ?
What is azure ado?
What are three methods for displaying data in a syncfusion datagrid
How to retrieve the third table value from the data set?
What are dcl commands?
What does ado stand for in ado.net?
How to check if a datareader is closed or opened?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)