C
C.Anand via DotNetMonster.com
Hi,
I have the following fragment of code which retrieves datarows from a data
table using the Select method.I want to add these rows into another data
table.But I get the Exception:
'Column "ReleaseDate" already belongs to another table'
// Use the Select method to find all rows matching the filter.
DataRow[] foundRows = dt.Select( strExpr, strSort,
DataViewRowState.CurrentRows);
int len = foundRows.Length;
DataColumn dc=new DataColumn();
foreach( DataRow r in foundRows )
{
foreach( DataColumn c in r.Table.Columns )
{
dc=c;
dt1.Columns.Add(c);
ColCnt=r.Table.Columns.IndexOf(c);
}
ii = 1;
}
dr=dt1.NewRow();
dr[ColCnt]=dc;
dt1.Rows.Add(dr);
}*/
I have the following fragment of code which retrieves datarows from a data
table using the Select method.I want to add these rows into another data
table.But I get the Exception:
'Column "ReleaseDate" already belongs to another table'
// Use the Select method to find all rows matching the filter.
DataRow[] foundRows = dt.Select( strExpr, strSort,
DataViewRowState.CurrentRows);
int len = foundRows.Length;
DataColumn dc=new DataColumn();
foreach( DataRow r in foundRows )
{
foreach( DataColumn c in r.Table.Columns )
{
dc=c;
dt1.Columns.Add(c);
ColCnt=r.Table.Columns.IndexOf(c);
}
ii = 1;
}
dr=dt1.NewRow();
dr[ColCnt]=dc;
dt1.Rows.Add(dr);
}*/