Hi,
How do I make ODBC connection to Mysql DB in VB?
Moderator: Moran Nave
Private Function ConnectString() As String
Dim strServerName as String
Dim strDatabaseName as string
Dim strUserName as string
Dim strPassword as string
'Make sure that you d/l and install the MySQL Connector/ODBC 3.51 Driver
strServerName = "localhost"
strDatabaseName = "DatabaseName"
strUserName = "UserName"
strPassword ="Password"
ConnectString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=" & strServerName & _
";DATABASE=" & strDatabaseName & ";" & _
"USER=" & strUserName & _
";PASSWORD=" & strPassword & _
";OPTION=3;"
End FunctionSet rs = New ADODB.Recordset 'Creates record set
strSQL = "SELECT * FROM table WHERE id = ..."
rs.Open strSQL, cn, strDBCursorType, strDBLockType, strDBOptions
Return to Open discussion - BPM R&D
Users browsing this forum: No registered users and 1 guest