What is the difference between DataRow and DataRowView

B

Bruce Wood

Well, a DataRow is a row in a DataTable, while a DataRowView is a row
in a DataView. So, the question becomes, what is the difference between
a DataTable and a DataView?

A DataView provides a different look into a DataTable. It is, if you
will a "false front"... a "façade" in front of a DataTable. The
DataTable holds the real data... the DataView looks just like the data
table, but allows you to do things to the data.

For example, you can ask your DataView to present only some of the
DataRows in your DataTable and not others. Or, you can ask it to
present the DataRows sorted in a particular order. You can't sort the
DataRows in a DataTable, but you can ask a DataView on a DataTable to
return its DataRowViews in a particular order. So, the DataView makes
it look as though the DataTable is sorted (when it really isn't).

In short, if you want to see (in a list view, for example, or a
DataGrid) the rows in a DataTable in a certain way, plunk a DataView
overtop of the data table and display the DataRowViews, instead of
displaying DataRows directly.
 

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