VBS Database connection to MySQL usting ODBC
Damn, this feels dirty …
Sub LogDateiInMSql(query)
db_server = "localhost"
db_user = "root"
db_pass = ""
db_name = "eparcel"
' init connection to MySQL
Set conn=CreateObject("ADODB.Connection")
' you need the odbc driver installed, obviously
strConnectString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=" & db_server & ";" _
& " DATABASE=" & db_name & ";" & "UID=" & db_user & ";PWD=" & db_pass & "; OPTION=3"
conn.Open strConnectString
If conn.State = 1 Then
MsgBox "connected"
Else
MsgBox "connection failed"
End If
Set rs=CreateObject("ADODB.recordset")
Set rs = conn.Execute(Sql)
Do While not rs.EOF
MsgBox rs(0)
rs.MoveNext
Loop
conn.Close
End Sub
LogDateiInMSql("show tables")