Pages

Thursday 27 February 2014

Add/Copy Rows from One Datatable to Another Datatable C#

Add/Copy Rows from One Datatable to Another Datatable C#

C# 
 
DataTable _dt=new DataTable();
_dt = _ds.Tables[0];
DataTable dt1 = ds1.Tables[0];
for (int i = 0; i < dt1.Rows.Count; i++)
{
_dt.ImportRow(dt1.Rows[i]);
}

VB

Dim _dt As New DataTable()
_dt = _ds.Tables(0)
Dim dt1 As DataTable = ds1.Tables(0)
For i As Integer = 0 To dt1.Rows.Count - 1
_dt.ImportRow(dt1.Rows(i))
Next


No comments:

Post a Comment