view to dataset

  • Thread starter Thread starter vijaya
  • Start date Start date
V

vijaya

I have a dataview with few rows. My requirement is that I
have to transfer the rows in the view to my table in the
dataset and bind the dataset to the datagrid.
How can I do move the rowsin my dataviewit?

thanks in advance,
vijaya
 
Hi vijaya,

Try this (v is your DataView and target is target table):
DataTable target = (DataTable)v.Table.Clone();

for (int i=0; i<v.Count; i++)

{

DataRow row = v.Row;

DataRow newRow = target.NewRow();

foreach (DataColumn col in v.Table.Columns)

newRow[col.ColumnName] = row[col];

target.Rows.Add(newRow);

}
 
Back
Top