Where in the .NET System.Data namespace is the code that determines, when the update-command is executed, whether a row in a SQL Server 2K table has been changed after the client program had read it in, i.e. that the client-side version of the row is "stale"?
I would like to use a decompiler to look at the code and figure out how it determines that a concurrency violation has happened. I know it will have something to do with a timestamp column in the table and/or @@rowcount but I'd like to see just what is going on when an update command wrapped in a stored proc is executed by the library.
The stored proc would have this structure:
create proc foo_update
@id int,
@rowversion timestamp,
@val varchar(5)
as
begin
update foo set a = @val
where id = @id and mytimestampcolumn = @rowversion;
end
That is, no row will be updated if it has changed because of the where-clause which compares the rowversion in the client-side System.Data.DataRow to the timestamp value of the row in the database, and the proc would run successfully and not generate an error. Yet the SqlClient libraries, in their helpfulness, report this scenario as a concurrency violation.
Thanks
Instead of using decompiler, look to real code. see following blog post for details. http://weblogs.asp.net/scottgu/archive/2008/01/16/net-framework-library-source-code-now-available.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With