DataView vs. DataSet

H

Hemang Shah

Hello

Few things to remove the cloud:

1) Can a DataView be a subset of a DataSet ?
2) DataSet consists of tables, is that different from a DataTable object ?
3) In IDE, when you create a DataSet it also generates update, add, delete
code, if you have controls bound to the DataView (which inturn points to
tables in the same DataSet), if you edit records / add / delete, will the
DataSet update / add / delete code still update these changes ?

Thank You
 
S

Sahil Malik

Glad you posted here. See how quickly you just might get an answer out of
this newsgroup ..
1) Can a DataView be a subset of a DataSet ?
No, only datatable. But datatables inside a dataset, alongwith relationships
might let you acheive what you're tryin' to do.
2) DataSet consists of tables, is that different from a DataTable object
?
Yes, A DataSet is a collection of Tables and Relations.
3) In IDE, when you create a DataSet it also generates update, add,
delete code, if you have controls bound to the DataView (which inturn
points to tables in the same DataSet), if you edit records / add / delete,
will the DataSet update / add / delete code still update these changes ?
Yes

:) Does that help?

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
H

Hemang Shah

Thanks for the reply Sahil yes it helps with my 3rd question, but I'm still
rusty on the first two:
1) Can a DataView be a subset of a DataSet ?
No, only datatable. But datatables inside a dataset, alongwith relationships
might let you acheive what you're tryin' to do.

DataView cannot be a subset of datatable, but DataView can consist of
Datatables correct ?
2) DataSet consists of tables, is that different from a DataTable object
?
Yes, A DataSet is a collection of Tables and Relations.

So how is a DataTable different from a table in a dataset ? Because we can
create a DataView object either from a datatable or a <dataset.table> so
what is the difference?

Thank You!

P.S: ADO can fetch information from an excel sheet as well right ? I'm sure
it does, just wanted a nod from u :)
 
S

Sahil Malik

DataView cannot be a subset of datatable, but DataView can consist of
Datatables correct ?

No .. DataViews can show you a view of a DataTable .. one DataTable, not
DataTable(s).
So how is a DataTable different from a table in a dataset ? Because we
can create a DataView object either from a datatable or a <dataset.table>
so what is the difference?

A dataset is .. well almost like a mini RDBMS in memory. A Datatable is just
one table of that mini rdbms.

... and Yes .. ADO can fetch information from an Excel sheet !! :) (NOD NOD).

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
H

Hemang Shah

Ok, our currencymanager is not in sync, because I'm not able to ask it
properly.

I understand the difference between tables and dataset (Thank God!)

But there are two objects: tables & DataTable - I want to know if there is
any difference between them.

When you create few dataadapter and generate dataset of them

suppose dataset ds consists of t1,t2 & t3.

Now in ADO there is a DataTable

Just by generating this dataset is t1,t2 & t3 already of type "DataTable' ?

because I've seen many codes expliciting enumerating

DataTable dtTable1 = ds.t1;

- Why would u do that when t1 is already a table ?....

I hope now my question is more lucid.
 
S

Sahil Malik

Tables is a collection of DataTables.
suppose dataset ds consists of t1,t2 & t3.
Just by generating this dataset is t1,t2 & t3 already of type "DataTable'
?
Yes

DataTable dtTable1 = ds.t1;
- Why would u do that when t1 is already a table ?....

Well, you'd do that if you wanted to refer to the dtTable1 again and again
... so instead of writing code like ds.t1.xxx, you could say .. dtTable1.xxx


- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
S

Scott M.

Think of a DataSet as a relational database held in memory only.

A DataSet has a Tables collection made up of DataTable objects.
A DataTable has a Columns collection made up of DataColumn objects
(equivalent to fields).
A DataTable also has a Rows collection made up of DataRow objects (records).
A DataRow has an Items collection made up of DataItems (field of a given
record).

A DataView is just that...a way of viewing existing data in a DataTable. A
DataView does not contain any data of its own. Another way of thinking
about a DataView is that it is a filtered and/or sorted look at the data in
a DataTable.

A DataSet also has a Constraints and a Relations collection to aid in using
a DataSet as a RDBMS in memory.
 
H

Hemang Shah

Thank You Scott

Now I know the tables generated in the dataset by IDE is automatically part
of the DataTable group (because those tables are DataTables!)

Thanks.

HS
 
S

Scott M.

Yes, but to get the terminology right:

DataTables are held in the Tables collection of a DataSet
DataRows are held in the Rows collection of a DataTable
DataColumns are held in the Columns collection of a DataTable
....ad nauseum...
 

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