+2005-01-25 Sureshkumar T <tsureshkumar@novell.com>
+
+ * DataRow.cs: CopyValuesToRow : set the column value with the
+ default version of the given row.
+ * DataTable.cs: ImportRow: Copy values before adding row.
+ * DataSet.cs: AddChangedRow: Add the row to the table after
+ copying values.
+
+ Fixes bug #67317. Patch by Ankit Jain.
+
2005-01-25 Atsushi Enomoto <atsushi@ximian.com>
* DataRowView.cs : Fixed IsEdit to reflect correct status of DataRow.
}
//Saving the current value as the column value
- row[index] = targetColumn[row._current];
+ row [index] = targetColumn [IndexFromVersion (DataRowVersion.Default)];
}
}
}
DataRow newRow = copyTable.NewRow ();
- copyTable.Rows.Add (newRow);
row.CopyValuesToRow (newRow);
+ copyTable.Rows.Add (newRow);
newRow.XmlRowID = row.XmlRowID;
addedRows.Add (row,row);
}
public void ImportRow (DataRow row)
{
DataRow newRow = NewRow();
- Rows.Add(newRow);
- row.CopyValuesToRow(newRow);
-
+ row.CopyValuesToRow (newRow);
+ Rows.Add (newRow);
+ row.CopyState (newRow);
}
internal int DefaultValuesRowIndex
+2005-01-25 Sureshkumar T <tsureshkumar@novell.com>
+
+ * DataTableTest.cs: added test case for checking ImportRow when
+ the row state is detached. Test case by Ankit Jain.
+
2005-01-25 Atsushi Enomoto <atsushi@ximian.com>
* DataRowViewTest.cs : added IsEdit tests and Item tess (not working).
col.ColumnName = "Id";
col.DataType = Type.GetType ("System.Int32");
table.Columns.Add (col);
-
+
col = new DataColumn ();
col.ColumnName = "Name";
col.DataType = Type.GetType ("System.String");
AssertEquals ("#A03", DataRowState.Modified, table.Rows [2].RowState);
AssertEquals ("#A04", DataRowState.Added, table.Rows [3].RowState);
}
+
+ [Test]
+ public void ImportRowDetachedTest ()
+ {
+ DataTable table = new DataTable ();
+ DataColumn col = new DataColumn ();
+ col.ColumnName = "Id";
+ col.DataType = Type.GetType ("System.Int32");
+ table.Columns.Add (col);
+
+ table.PrimaryKey = new DataColumn [] {col};
+
+ col = new DataColumn ();
+ col.ColumnName = "Name";
+ col.DataType = Type.GetType ("System.String");
+ table.Columns.Add (col);
+
+ DataRow row = table.NewRow ();
+ row ["Id"] = 147;
+ row ["name"] = "Abc";
+
+ // keep silent as ms.net ;-), though this is not useful.
+ table.ImportRow (row);
+ }
+
[Test]
public void ClearReset () //To test Clear and Reset methods
{