This post will illustrate you to how to Copy a DataView Row to a DataTable Row. This have a precondition that both Datarow and Datarowview should have same structure.
To make same structure you can make clone of them.
/// <summary>
/// PURPOSE : To copy a dataview row to a datatable row.
/// <para>IN Parameter: Datarow, DataRowView</para>
/// IMPORTANT NOTE: Both datarow,datarowview should have the same structure
/// </summary>
/// <param name="returnRow"></param>
/// <param name="pDvRow"></param>
/// <returns></returns>
public static DataRow CopyDvRowToDtRow(DataRow returnRow, DataRowView pDvRow)
{
int maxCnt = pDvRow.DataView.Table.Columns.Count;
for (int cnt = 0; cnt < maxCnt; cnt++)
{
returnRow[cnt] = pDvRow[cnt];
}
return returnRow;
}
0 comments:
Post a Comment