L
Les Caudle
I'd like to be able to create a new row, init some fields of the row, and then
set the row to DataRowState.Unchanged or dr.AcceptChanges so that when I
sequence thru the rows of the DataTable, this row will not appear to be changed
unless the user actually changes a field.
Unfortunately, you can't AcceptChanges on a new record - and dr.RowState is
readOnly.
Is there some way to accomplish this?
DataTable dt = ds.Tables["Transaction"];
DataRow dr = dt.NewRow();
dr["transDesc"] = "new transaction";
dr["transAmt"] = 0;
dr["transDate"] = DateTime.Now;
// dr.RowState = DataRowState.Unchanged; readonly
// dr.AcceptChanges(); won't work here
dt.Rows.Add(dr);
set the row to DataRowState.Unchanged or dr.AcceptChanges so that when I
sequence thru the rows of the DataTable, this row will not appear to be changed
unless the user actually changes a field.
Unfortunately, you can't AcceptChanges on a new record - and dr.RowState is
readOnly.
Is there some way to accomplish this?
DataTable dt = ds.Tables["Transaction"];
DataRow dr = dt.NewRow();
dr["transDesc"] = "new transaction";
dr["transAmt"] = 0;
dr["transDate"] = DateTime.Now;
// dr.RowState = DataRowState.Unchanged; readonly
// dr.AcceptChanges(); won't work here
dt.Rows.Add(dr);