You need to put this on the beginning of the app
Code:
Dim db_name, db_server, db_port, db_user, db_pass, constr As String
And implement to the VB code couple of "things" like that:
Code:
Private Sub ConnServer()
'connect to MySQL server using MySQL ODBC 3.51 Driver
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=localhost;" _
& " DATABASE=PERSONAL;" _
& "UID=root;PWD=root; OPTION=3"
conn.Open
End Sub
Code:
Private Sub OpenServer() 'Connect MySQL Server Without ODBC setup
constr = "Provider=MSDASQL.1;Password=;Persist Security Info=True;User ID=;Extended Properties=" & Chr$(34) & "DRIVER={MySQL ODBC 3.51 Driver};DESC=;DATABASE=" & db_name & ";SERVER=" & db_server & ";UID=" & db_user & ";PASSWORD=" & db_pass & ";PORT=" & db_port & ";OPTION=16387;STMT=;" & Chr$(34)
Set conn = New ADODB.Connection
conn.Open constr
End Sub
Code:
Public Sub OpenConnection1()
On Error GoTo DBerror
db_name = "personal"
db_server = "localhost"
db_port = "3306" 'default port is 3306
db_user = "root"
db_pass = "root"
'ConnServer ' Open with ODBC in Control Panel
OpenServer ' Open without ODBC in Control Panel
Rx = 0
ShowData
ShowGrid
Exit Sub
DBerror:
ShowData
ShowGrid
End Sub
And of course showdata an similar definitions.