Problem updating a record containing a negative Value

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: R. Lowke (rolf_at_work_at_lycos.de)
Date: 09/01/04


Date: Wed, 1 Sep 2004 17:32:13 +0200

Hello,

I use an ADO recordset in Visual Basic to connect to an iSeries-table via
ODBC (Client Access ODBC Driver) and have to update some records. This works
fine until I want to update a record that contains a negative value. Then I
get the error message "Row cannot be located for update...". The table has a
primary key and i can update if the current record contains no negative
values. It does not matter which numeric field contains the negative value.
I can update even rows with negative values if I use SQL (UPDATE) directly,
but that's no acceptable solution. Here is an example code snippet. Test1
and Test2 are decimal values, if Test1 contains a negative value the
mentioned error occurs.

Set cnn = New ADODB.Connection
With cnn
   .CursorLocation = adUseServer
   .ConnectionString = "DSN=Test"
   Call .Open
End With

Set rec = New ADODB.Recordset
With rec
   .ActiveConnection = cnn
   .CursorLocation = adUseServer
   .LockType = adLockOptimistic
   .CursorType = adOpenDynamic
   .Source = "TEST.TEST"
   Call rec.Open(Options:=adCmdTable)
   If .State = adStateOpen Then
      Do While Not rec.EOF
         rec!Test2 = 42
         Call rec.Update
         Call rec.MoveNext
         DoEvents
      Loop
   End If
End With

Can anyone help me, please!?



Relevant Pages