Optimistic Concurrency - DataRow.Column Error Property Not Set

C

CPatrick_530

I'm implementing an optimistic concurrency model within a VB.net
application which makes use of a SQL Server 2000 database. I'm able to trap
concurrency errors caused by an Update stored procedure, and can easily work
with the DataRows which have errors, but cannot figure out why the
ColumnError properties are not set. Using the DataRow.GetColumnsInError or
DataRow.GetColumnError(column) methods return ziltch. The DataRow simply
has a "concurrency error, the update effected 0 records" error. I test for
concurrency issues by including all editable fields within the WHERE clause
of the UPDATE stored procedure. I'm also using a DataAdapter to call the
appropriate Select, Insert, Update, and Delete stored procedures. My
DataAdaptor is set to continue updates when errors are encountered.

I guess that I don't understand which object is responsible for setting the
column error property, and when it's supposed to happen. Any help would be
appreciated. I can work around this by comparing row version values, but
knowing that there is an easier way is eating away at me.

- CPatrick_530
 
S

Sahil Malik [MVP]

I could be wrong on this, but AFAIK, GetColumnError doesn't return anything
unless you've called SetColumnError yourself i.e. it ain't automatic like
you are looking for it to be. .. I know that sucks, so I'm hoping I'm wrong
on this one :).
What you could do however in your data layer is that on the RowUpdating and
RowUpdated events, you could set the appropriate error yourself. (Now that's
easy huh?) :)

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top