J
J055
Hi
This code does not update the copyTbl rows. I.e. when the copyTbl object is
merged into the dataset actions on the rows of this table are not reflected
in the copyTbl. I want the copyTbl to reflect changes made to the
ds.Tables["Sets"].Rows.
private void PopulateCopyTableFromGroupsTable(DataTable copyTbl)
{
DataSet ds = new DataSet();
DataTable groupsTbl = new GroupsBLL().GetAll();
ds.Merge(groupsTbl);
ds.Merge(copyTbl);
DataRelation relation =
ds.Relations.Add(ds.Tables["Groups"].Columns["GroupID"],
ds.Tables["Sets"].Columns["GroupID"]);
DataRow groupRow;
foreach (DataRow setRow in ds.Tables["Sets"].Rows)
{
groupRow = setRow.GetParentRow(relation);
setRow["GroupCode"] = groupRow["Code"];
}
}
How should I do this?
Thanks
Andrew
This code does not update the copyTbl rows. I.e. when the copyTbl object is
merged into the dataset actions on the rows of this table are not reflected
in the copyTbl. I want the copyTbl to reflect changes made to the
ds.Tables["Sets"].Rows.
private void PopulateCopyTableFromGroupsTable(DataTable copyTbl)
{
DataSet ds = new DataSet();
DataTable groupsTbl = new GroupsBLL().GetAll();
ds.Merge(groupsTbl);
ds.Merge(copyTbl);
DataRelation relation =
ds.Relations.Add(ds.Tables["Groups"].Columns["GroupID"],
ds.Tables["Sets"].Columns["GroupID"]);
DataRow groupRow;
foreach (DataRow setRow in ds.Tables["Sets"].Rows)
{
groupRow = setRow.GetParentRow(relation);
setRow["GroupCode"] = groupRow["Code"];
}
}
How should I do this?
Thanks
Andrew