T
Timo
I'm having trouble with concurrency errors (0 records affected)
but the Core Reference section relating to this subject seems to
have an error in the code sample. Maybe I'm wrong about this;
could someone please correct me if so!
On p. 473, the timestamp column is being assigned a value
e.Row("TSCol") = ....
and the penultimate paragraph on the page reads:
"After retrieving the new timestamp value and assigning it to the
appropriate column in the DataRow object..."
** But when I try to assign this column, I get an error that my
(SQLServer2000) timestamp column is READONLY. **
My update command uses the Primary Key and the timestamp columns
to check for concurrent changes to the row. My update command goes
like this:
Update T
Set ...
where PK = @PK and TS = @TS
And in the OnRowUpdated eventhandler, I assign the UpdateCommand
timestamp parameter as follows:
UpdateCommand.Parameters("@TS").Value = cmdGetTS.ExecuteScalar
However, when I make a second change to a record that I have just
updated (the scenario described at top of p.469 in Core
Reference), I get a concurrency error (0 records affected) even
though I am indeed using the most recent timestamp and have
correctly assigned the TS and PK parameters of my update query
prior to invoking the DA.Update() method.
Page 469 reads: "If you don't have the new value for the timestamp
column in your DataRow object, the subsequent update attempt will
fail."
I don't understand why the *row* must contain the new timestamp
value if one is using the primary key and the timestamp to test
for concurrency problems, and the update command takes the form
"Update Table ...where PK=@PK and TS=@TS". Wouldn't you want to
assign the UpdateCommand.Parameters("@TS") instead of the
e.row("TS")?
Clarification appreciated!
Timo
but the Core Reference section relating to this subject seems to
have an error in the code sample. Maybe I'm wrong about this;
could someone please correct me if so!
On p. 473, the timestamp column is being assigned a value
e.Row("TSCol") = ....
and the penultimate paragraph on the page reads:
"After retrieving the new timestamp value and assigning it to the
appropriate column in the DataRow object..."
** But when I try to assign this column, I get an error that my
(SQLServer2000) timestamp column is READONLY. **
My update command uses the Primary Key and the timestamp columns
to check for concurrent changes to the row. My update command goes
like this:
Update T
Set ...
where PK = @PK and TS = @TS
And in the OnRowUpdated eventhandler, I assign the UpdateCommand
timestamp parameter as follows:
UpdateCommand.Parameters("@TS").Value = cmdGetTS.ExecuteScalar
However, when I make a second change to a record that I have just
updated (the scenario described at top of p.469 in Core
Reference), I get a concurrency error (0 records affected) even
though I am indeed using the most recent timestamp and have
correctly assigned the TS and PK parameters of my update query
prior to invoking the DA.Update() method.
Page 469 reads: "If you don't have the new value for the timestamp
column in your DataRow object, the subsequent update attempt will
fail."
I don't understand why the *row* must contain the new timestamp
value if one is using the primary key and the timestamp to test
for concurrency problems, and the update command takes the form
"Update Table ...where PK=@PK and TS=@TS". Wouldn't you want to
assign the UpdateCommand.Parameters("@TS") instead of the
e.row("TS")?
Clarification appreciated!
Timo