copying dataview rows to datatable
Posted on 2004-03-31
I have a dataset with over 5000 rows of data so I use a dataview to filter the data to about 10 rows. Now I need to display these 10 rows as XML. Since the dataview dosn't have a method to display the data in XML, I was thinking of doing the following:
Create a datatable that's an exact replica (without the data) of an existing datatable in the dataset:
DataTable DataTable_Model = DataSet_AddrRec.Tables;
DataTable DataTable_filter = DataSet_AddrRec.Tables.Add("TableFilter");
int iColumnCount = DataTable_Model.Columns.Count;
for (int i=0; i < iColumnCount; i++)
and once I have this new datatable, I'd like to copy the rows in the dataview to this new datatable.
Is this possible? The problem I'm having is that I don't know how to extract data from the view. This is also assuming that I can write the data in a datatable as XML.
Any help would be appreciated,