object model - dataset, dataadapter, datatable

M

Miha Markic

Hi,

Kalpesh Shah said:
Hello All,

Could you guys help me understand the ado.net object model ?
This is what I think, correct me if I am wrong

* DatAdapater acts as a bridge to bring in/send out data to database
Yep.

* Dataset is in-memory cache, disconnected from db, doesnt talk to db directly

Yep.

* DataTable could be a part of dataset.
Yep.

could multiple table from a common datasource be a part of same dataset ?
Yep.

* How to add multiple tables to same dataset, using same datasource ?

Normally, with one adapter per table.
* A separate dataadapter is needed, for each SELECT/Stored proc, which will bring in data to dataset
Can a single dataadapter be used for multiple tables added to the same
dataset having common source ?

No. Though command class has this power.
I am somehow confused & thinking that there has to be 1 dataadapater for
each SELECT querying diff tables

Yes.

You passed ;-)
 
K

Kalpesh Shah

Hello All,

Could you guys help me understand the ado.net object model ?
This is what I think, correct me if I am wrong

* DatAdapater acts as a bridge to bring in/send out data to database
* Dataset is in-memory cache, disconnected from db, doesnt talk to db directly
* DataTable could be a part of dataset.
could multiple table from a common datasource be a part of same dataset ?
* How to add multiple tables to same dataset, using same datasource ?
* A separate dataadapter is needed, for each SELECT/Stored proc, which will bring in data to dataset
Can a single dataadapter be used for multiple tables added to the same dataset having common source ?

I am somehow confused & thinking that there has to be 1 dataadapater for each SELECT querying diff tables

Regards
Kalpesh
 
K

Kalpesh Shah

So, does it mean that I will have to use 3 adapaters to fill

SELECT * FROM table1
SELECT * FROM table2
SELECT * FROM table3

which will fill it in a single dataset. If I use command class, I dont need 3 adapaters, right ?

Thanks buddy for your help & passing me out ;-)

Kalpesh
 
W

William \(Bill\) Vaughn

Close... one wrong out of the lot... a pretty good score. ;)

The DataAdapter is simply (as you say) a bridge from the Connection to one
or more DataSets. If the SelectCommand contains a query that returns
multiple rowsets (multiple resultsets that contain rowsets), each rowset is
used to construct a separate DataTable. Yes, there are situations where (if
you set the switches right) subsequent rowsets are _merged_ with existing
DataTables so new rows are added to the end of the DataTable and primary key
matched rows are updated.

That said, Miha is right. If you expect to update the DataSet and its
DataTables, you'll need a separate DataAdapter for each
rowset/DataTable/data source. This way you can specify the correct action
queries for each data source.

This is explained in more detail in my book.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
K

Kalpesh Shah

Thanks Miha & William for helping me & understanding my difficulties
:)

Cheerz
Kalpesh
 
D

David Sceppa

Kalpesh,

You can still use a single DataAdapter to fetch the results
of a batch of SQL queries like the one you described. See the
documentation for the TableMappings property of the DataAdapter.
The advice about using one DataAdapter per DataTable is more of a
requirement for updating scenarios.

I hope this information proves helpful.

David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2003 Microsoft Corporation. All rights reserved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top