Hello

Need urgent help on this.


I am currently working on an application in VB 6.0 and the database is MySQL .

The purpose of this code is to calculate the number of non empty fields in the table DailyQCRed from columns 4 to 40 ignoring in between columns 34 to 37.

Please note that I have tried both Dynamic, Keyset recrodsets and optimistic and pessimistic locking. Still I get errors.

In the code below I get the error that says

"Query based update failed because the row to update could not be found"

rstRecordset.Open "Select * from DailyQCRed", cn, adOpenDynamic, adLockPessimistic
Do While Not rstRecordset.EOF
ifld = 0
For i = 4 To 40
If i < 34 Or i > 37 Then
If rstRecordset.Fields(i).Value <> "" Then
ifld = ifld + 1
End If
End If
Next i
rstRecordset!FillFields = ifld
rstRecordset.Update
rstRecordset.MoveNext
Loop
rstRecordset.Close

Can anyone help me incase there is something wrong with the logic though I think the logic is OK. I tried to get the figures by putting message boxes and they came correct. I think the error lies in the syntax. Perhaps the syntax used for Mysql dtabase update through VB is different from the one I have used above.

Is there any Mysql version issue. I am working on MySQL Ver 4.0.

Thanks
Manish