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

Re: Optimistic Concurrency - DataRow.Column Error Property Not Set by Sahil

Sahil
Tue Aug 02 22:10:49 CDT 2005

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
----------------------------------------------------------------------------

"CPatrick_530" <CPatrick_530@community.nospame> wrote in message
news:uQt7e18lFHA.3288@TK2MSFTNGP09.phx.gbl...
> 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