W
-=Wojtek=-
Hi!
I am trying to refresh identity column for datatable with computed(by
ado.net) column.
I have realized that I cant use batch query in dataadapter InsertCommand
because after DataAdapter.Update() Framework changes the "ReadOnly" property
of
computed column throwing an exception. That is why I wrote an EventHandler
for RowUpdated event of my DataAdapter. The problem is that another
exception was thrown
during modification of e.Row: " System.Data.VersionNotFound: There is no
Original data to access.
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMErge)
at System.Data.DataRow.EndEdit() .."
Do you know what is wrong with my code?
Thanks for help!
Wojtek
private void daRataSkladkiRowUpdated(object sender, SqlRowUpdatedEventArgs
e)
{
if ((e.StatementType == StatementType.Insert) & (e.Status ==
UpdateStatus.Continue))
{
e.Row["ID_Raty_Skladki"]=(int)odswiezRateSkladki.ExecuteScalar(); //returns
@@Identity
e.Row.AcceptChanges();
}
}
I am trying to refresh identity column for datatable with computed(by
ado.net) column.
I have realized that I cant use batch query in dataadapter InsertCommand
because after DataAdapter.Update() Framework changes the "ReadOnly" property
of
computed column throwing an exception. That is why I wrote an EventHandler
for RowUpdated event of my DataAdapter. The problem is that another
exception was thrown
during modification of e.Row: " System.Data.VersionNotFound: There is no
Original data to access.
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMErge)
at System.Data.DataRow.EndEdit() .."
Do you know what is wrong with my code?
Thanks for help!
Wojtek
private void daRataSkladkiRowUpdated(object sender, SqlRowUpdatedEventArgs
e)
{
if ((e.StatementType == StatementType.Insert) & (e.Status ==
UpdateStatus.Continue))
{
e.Row["ID_Raty_Skladki"]=(int)odswiezRateSkladki.ExecuteScalar(); //returns
@@Identity
e.Row.AcceptChanges();
}
}