I have been fighting with Visual Basic and replication for a few weeks, and
I finally found out a solution.
I am using Visual Basic v6 SP5, MySQL v4.0.11 Server and MyODBC 3.51.06.
How-To-Repeat:
When adding a record with Visual Basic and ADO, it adds the record to the
Master, but it doesn't replicate the record add on the Slave. There is no
error, and the bin-log file is added to.
I have found that this code did not work within Visual Basic with
replication (This will include any .addnew or .update or .delete methods):
Dim myConn As New ADODB.Connection
Dim myRS As New ADODB.Recordset
myConn.Open "DRIVER={MySQL ODBC 3.51
Driver};SERVER=192.168.10.1;DATABASE=SchedulePro;USER=root;PASSWORD=;OPTION=
35;"
myRS.Source = "SELECT * FROM employees"
Set myRS.ActiveConnection = myConn
myRS.CursorLocation = adUseClient
myRS.Open , , adOpenDynamic, adLockOptimistic
With myRS
.AddNew
![employee_id] = 4
.Update
.Close
End With
myConn.Close
Set myRS.ActiveConnection = Nothing
'-----------------------------------------------------------------
However, this code does work with replication on adding, deleting, and
modifying:
Dim myConn As New ADODB.Connection
myConn.Open "DRIVER={MySQL ODBC 3.51
Driver};SERVER=192.168.10.1;DATABASE=SchedulePro;USER=root;PASSWORD=;OPTION=
35;"
myConn.Execute "INSERT INTO schedule_log (employee_number) VALUES (4)"
myConn.Close
'-----------------------------------------------------------------
There has to be some bug on how the record is actually added to the master
just fine, but yet the replication does not occur. I hope this helps others
with the same problem. If there is a different way to access MySQL, someone
please email me with a new connection method. Thanks.
Also, if anyone can shed any light on this MAJOR bug, please ket me know
thanks...
Aaron
| Thread |
|---|
| • Visual Basic Replication Problems | Aaron Weed | 12 Mar |