954,559 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Commend -Connection for MySQL with VB6

Hi,

If you are interest in using MySQL as your back end database, here is one way to connect:
By using ODBC:

'Declare ADODB variable
Public ConnectData As New ADODB.Connection

Set ConnectData = New ADODB.Connection
ConnectData.Open "DSN=MySQL_ODBC"


If you want to use MySQL ODBC 3.51 Driver , You can write the connection like this:

Set ConnectData = New ADODB.Connection
'ConnectData.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;Database=Databasename;UID=Username;PWD=Password;OPTION=3"

ConnectData.Open


If you want to use MySQL ODBC 5.1 Driver , You can write the connection like this:

ConnectData.ConnectionString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;Database=Databasename;UID=Username;PWD=Password;OPTION=3"
ConnectData.Open


I hope this will be helpful for New learner. If there is another new easy and simpler way, give your sugestion here.

K.Vanlalliana
Light Poster
44 posts since Jul 2008
Reputation Points: 10
Solved Threads: 4
 

i think the connection string is already available here and the rest VB part is same for all databases.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You