I am working with a gridview and the data is from sql2008 using a stored proc
(soon to be a view). What I would like to know (albeit after the fact) is it
better to use a DataTable or a DataView for retrieving the information? Plus
and Minus of each if possible. Links are good, too.
Thanks.
JE
DataTable is to store the physical data,
DataView is to view that data.
A major function of the DataView is to allow for data binding.
Additionally, a DataView can be customized to present a subset of data
from the DataTable. This capability lets you have two controls bound
to the same DataTable, but that show different versions of the data.
For example, one control might be bound to a DataView that shows all
the rows in the table, and a second might be configured to display
only the rows that have been deleted from the DataTable. The DataTable
also has a DefaultView property. This returns the default DataView for
the table. For example, if you want to create a custom view on the
table, set the RowFilter on the DataView returned by the DefaultView.
All this means that when you have a DataTable and you need to sort or
filter it, use a DataView. Otherwise, use DataTable
http://msdn.microsoft.com/en-us/library/system.data.dataview.aspx
http://dotnetperls.com/dataview-usage