Concurrency violation when updating row

Concurrency violation when updating row

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

Postby 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.
Serious
 


Return to dotConnect for MySQL