What Different between DataReader and DataSet?

sjchin

Member
Joined
Mar 21, 2003
Messages
22
May i know what different between datareader and DataSet? When to used these 2? As i know both also working fine in connect to DB.
 
DataReader is just a basic object that reads one record at a time and needs to be connected to the database. DataSet can work in "disconnected" mode and can represent your entire database in memory.
 
I like to think of it like this... the DataSet is Microsofts favorite child, while the DataReader gets little reference, and remains in his room where few people will find him.
 
May i know if i want to used 2 connect SQL at a same time,which shall i used? I try DataReader, when i try to connect other datareader, it appear error and ask me to close my 1st reader before open 2nd, may i know what the problem?
 
You can only have one DataReader associated with a connection at a time. Open another connection and associate the second DataReader with it.
 
How about Can i do it in DataSet? Can it support 2 connect SQL at the same time in 1 connection?
 
Yes, you can have multiple DataSets per connection, since they really arent associated with any connection object per se.
 
Back
Top