I'm trying to connect vb6 with MySql but it gives me an error
I show connection code
Option Explicit
Public cn As ADODB.Connection
Public rs As ADODB.Recordset
Public Sub Conectar()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
cn.Open "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=gestvehicular; User=root;Password=123456;Option=3;"
End Sub
Trying to register and log in
Private Sub btnGuardar_Click()
If txtNombre.Text <> "" Then
Dim strSql As String
strSql = "INSERT INTO gvehi_colores(descripcion) VALUES('" + txtNombre.Text + "')"
On Error GoTo tratarError
Dim cmd As New Command
Conectar
With cmd
.ActiveConnection = cn
.CommandText = strSql
.CommandType = adCmdText
.Execute
End With
On Error GoTo 0
Desconectar
Exit Sub
tratarError:
MsgBox Err.Description
End If
End Sub
I downloaded the mysql connector Download Connector / ODBC
I created the ODBC but I still get the error that I show in the image, I'm working on OS Windows 7 32 bites sp1 I tried to update to sp2 but I already downloaded all the updates and have done but I have not managed to get the sp2.
This link was used as the source for this implementation [MySQL Sample for Visual Basic 6.0 - read / write
] 3