
recordset.update updates > 1 row
I am using VB6 SP3 on Win2000 with ADO2.1 referenced in my project.
I am opening a recordset with the following SQL:
SELECT oh_lock FROM Order_Header WHERE oh_id = '1'
(oh_id is the key field and this SQL returns 1 row)
I then write to the database on the following condition:
If (rst!oh_lock & "") = "" Then
rst!oh_lock = "hello"
rst.Update
Else ...
The trouble is, this sets oh_lock in ALL records in Order_Header
where oh_lock is null to "hello".
I can fix this by changing the SQL to:
SELECT oh_id, oh_lock FROM Order_Header WHERE oh_id = '1'
Now, only 1 row (ie where oh_id = '1') will be updated.
Is this a bug or is this supposed to happen? It doesn't seem right to me.
Mark
ps I am using Access database, adLockOptimistic and adOpenForwardOnly