Sunday, April 10, 2011

MySQL and ADO

I am getting this error message in VB6 with MySQL

-2147217864 Row cannot be located for updating. Some values may have been changed since it was last read.
I've opened recordset and change some fields . Then I tried to update recordset and had the error message
Set rsCt = New Recordset
rsCt.CursorLocation = adUseClient
rsCt.open SQLstring, mConn, adOpenStatic, adLockOptimistic
rsCt!OrderNumber = pbOrderNumber
rsCt!CustomerID = custID
rsCt.Update

I spent several hours searching for a solution. Changed primary keys in my tables,used different options in rsCt.Open . And eventually found a small message on forum.mysql.com


Open properties fo your DNS (Windows XP: Control Panel->Administrative Tools->Data Sources) and find option Return Matching Rows (turn it on).

Also, you can do this under connection string specity parameter OPTION=2.

This should work...

Osman :D

I added to my connection string option=2

ConnectionString = "driver={MySQL ODBC 5.1 Driver};option=2,server=" & mySqlIP & ";uid=" & usr_id & ";pwd=" & pass & ";database=" & Database

Finally the problem is solved. Thanks Osman!!!