Ask the Expert

Accessing remote MySQL DBs in VB6

I'm looking for a way to access and control remote MySQL DBs in VB6 using either sockets or a free VB control. Do you have any examples of how to manipulate them?

    Requires Free Membership to View

MySQL supports ODBC. Download the ODBC drivers. In your VB project, add the Microsoft Remote Data Object and connect. Your connection code might look something like this:

Dim cnMySql As New rdoConnection
cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = "DRIVER={MySQL ODBC 3.51 Driver};" & _
 "SERVER=yourHostName;PORT=3306;" & _
 "DATABASE=dbName;" & _
 "UID=yourUserName;PWD=yourPassword;" & _
 "OPTION=3;"
Check the values for the OPTION parameter.

This was first published in September 2006

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.