Concurrency violation when updating row

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
guest

Concurrency violation when updating row

Post by guest » Tue 08 Feb 2005 13:07

Is there a way to update rows which have a null value (0000-00-00 00:00:00) in a DateTime field with optimistic locking? I always get a concurrency violation error.

Regards
Dirk

Serious

Post by Serious » Wed 09 Feb 2005 10:38

In order to update rows which have null values you need to use the following syntax:

Code: Select all

UPDATE
  dept 
SET 
  deptno = :p1, 
  DNAME = :p2, 
  LOC = :p3 
WHERE 
  ((deptno = :p4) AND ((:p5 IS NULL AND DNAME IS NULL) OR (DNAME = :p5)) AND ((:p6 IS NULL AND LOC IS NULL) OR (LOC = :p6)))
This code is compartible with table `dept` (see MySQLDirect .NET demo projects).
If you use data adapters you must manually create update command with similar query.

Post Reply