Hi Ali,
Thank you for using MSDN Newsgroup! My name is Kevin, and I will be
assisting you on this issue.
First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know between DataSet and
DataReader, which is better on a data retriving only operation. If there's
anything I misunderstood, please feel free to let me know.
I think this depends on the environment you're working one. Generally
speaking, the DataReader is used in a connected circs while DataSet is used
in disconnected circs. It means that when working on a DataReader, the
Connection to the data source should always be opened. DataReader will
retrieve data from the source once a record with DataReader.Read() method.
However, DataSet is a dump of data in the local memory on client machine.
It puts all the rows in to the DataSet with DataAdapter.Fill() method.
Because an active connection is not required when manipulting on a DataSet,
we can also persist data with DataSet.WriteXml(). DataSet is much more
powerful than DataReader. It can also link parent and child table with
DataRelation objects. Thus makes the DataSet able to maintain hierachical
data.
Also, just as Miha mentioned in his post, the DataAdapter actually calls
DataReader to retrieve data. So calling DataAdapter.Fill() might be much
slower than the ExecuteReader(), because it is "dumping" data to the client
side. However, after the data is get to the client, it will be faster to
manipulate on local data than get data from source each time with
DataReader.Read().
Here's an article about introduction to ADO+(ADO .NET): Data Access
Services for the Microsoft .NET Framework
http://msdn.microsoft.com/msdnmag/issues/1100/adoplus/default.aspx
For information about DataSet class and SqlDataReader class, pleaser refer
to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemDataDataSetClassTopic.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatasqlclientsqldatareaderclasstopic.asp
For more information, please refer to the following links:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbconfundamentaldataconceptsinvisualstudionet.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconoverviewofadonet.asp
I've checked your code in your last post. This is a good function which
returns a SqlDataReader object. Do you have any concerns on it? If so,
please feel free to let me know, and I would like to provide more detailed
information on that.
Does this answer your question? If anything is unclear, please feel free to
reply to the post.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."