Hi,
I'm developing a VB6 application connecting to a MySQL database. I'm getting run-time error 3001: arguments are of the wrong type, are out of an acceptable range, or are in conflict of each other.
I'm using the ODBC driver from MySQL. I would appreciate if anyone could spot where I'm going wrong as this is the first time I'm using VB6 to connect to a DB.
Private Sub Command1_Click()
Dim dbuser As String, password As String, dbname As String, hostname As String
Dim sql As String
Open App.Path & "\settings.txt" For Input As #1
Line Input #1, dbuser
Line Input #1, password
Line Input #1, dbname
Line Input #1, hostname
Close #1
Set conn = New ADODB.Connection
Set login = New ADODB.Recordset
conn.Open "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=" & hostname & ";" & "DATABASE=" & dbname & ";" & "UID=" & dbuser & ";" & "PWD=" & password & ";"
sql = "SELECT * FROM tblUser WHERE user=& txtUsername.Text & AND password=& txtPassword.Text;"
login.Open conn, sql
End Sub
Cheers,