Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataAdapter vs DataReader 1

Status
Not open for further replies.

khowell78737

Programmer
Nov 18, 2003
22
US
Please enlighten me to the advantages of one over the other. I understand that one is direct and one is disconnected. For a non-networked desktop application, shouldn't the simplicity of a direct access weigh heavily in favor of it? Or am I missing the point altogether.

Thanks in advance
Kevin Howell
 
A DataReader is a forward-only row iterator. This means you can't hop around in it, nor go backwards through it. You can only start at the beginning and read to the end. For this purpose, it's very fast and very lightweight.

A DataAdapter acts as a bridge between a DataSet and the source of the data (mostly a database, but not always). You call Fill to read from the datasource, and Update to perform the needed INSERT, UPDATE, or DELETE actions.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Does the update, insert and delete actions apply to the underlying datastore or just to the DataAdapter?

If it doesn't work on the datastore, how do you then update, insert or delete the source data?

Thanks!
Kevin Howell
 
the dataadapter applys the changes you made to the datastore after .update(datasetname) and uses an update, delete or insert were needed.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
If I have an MDI parent form and run procedures from another class (say cls_db) that fills public datasets with a public dataadapter that are declared in the form initalization, would these objects (datasets and dataadapter) remain available to me until the form is closed?

Secondly, if I wrote a procedure in a class to fill a dataset from information passed in from another class (like strSQL and a connection object) what am I returning with the function- the adapter or dataset?

Thank you for helping me understand this concept.

Kevin Howell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top