How to choice between DataTable and DataView

G

Guest

I often confuse about the use of DataTable and DataView
How to choice between DataTable and DataView
 
W

W.G. Ryan eMVP

You don't have to choose. A DataView is avirtual table based on a
DataTable. YOu can get at the underlying table of a DataView by it's Table
property and you can create a view from a table by its DefaultView property.
Either way you can get from one from the other. If you need sorting and
searching a DataView is probably the better choice particularly in
databinding situations - but they play well together so it's not an either
or.
 
C

Cor Ligthert

Flying,

Easy, use the datatable only in things as setting of relations.
Otherwise use forever its defaultview (what is a dataview)
When you need more dataview because you want to show things in different
ways.
Than create extra *New* dataviews.

I hope this gives some ideas,

Cor
 
S

Sahil Malik [MVP]

DataView is a subset of DataTable based on a condition - that is the
reasoning behind the choice.

(Note when I say subset - I mean subset of rows, DataView otherwise is a
brand new object that holds references to the underlying
datatable/datarows).

- Sahil Malik [MVP]
Upcoming ADO.NET 2.0 book - http://tinyurl.com/9bync
 
S

Sahil Malik [MVP]

BTW - I want to add - When you choose between the two, or data relation or
dataset depends on your exact situation - what exactly are you trying to do?

- Sahil Malik [MVP]
Upcoming ADO.NET 2.0 book - http://tinyurl.com/9bync
 

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