In this article we will tech you how to creating a mysql database and connect mysql database with visualbasic 6 This is one of the queries comes to my mind when I first used to working with visual basic six . ( Vb6 ) in
Besides backend as mysql database . Actually, I have to put in the MySQL ODBC connector. that
you can find on the MySQL web site .
Just select the appropriate driver , for example , along the windows often I decide windows in Windows
MSI Installer ( x86) Download this driver ODBC connector, click the link or the mirror in
appropriate Internet site from the link above .
After downloading the ODBC connector for mysql double-click the computer to configure following
screen instructions ( installation wizard ) . Your MySQL ODBC connector is installed and all set to
How to evaluate the driver is successfully installed.
Go to Control Panel, Administrative Tools.
Double-click Data Source (ODBC ) icon.
Click the Drivers tab and determine that "MySQL ODBC 5 . 1 Driver " is available in the list of all ODBC
Now you are ready to connect to the mysql database with vb 6.
Well, now you have to follow these steps in preparing to use the mysql database with your
configuring Visual Basic project .
1. create database
Two . create user
Three . Assigning user privileges to database created
April . create table in the database .
You can then use the following code quite easy in Visual Basic 6. ( Vb6 ) to connect to your
From vb code
As String Dim strConnectionString
As ADODB.Connection Dim Tconnection
Dim trecord As ADODB . SLCT As String Dim Recordset strConnectionString = " DRIVER = MySQL ODBC DRIVER 5 1. ;
SERVER = localhost; YourDatabaseName DATABASE = , PORT = 3306 , UID = user; PWD = password ; OPTION = 3 "
Tconnection Set = new ADODB.Connection
tconnection . ConnectionString = strConnectionString tconnection . open
SLCT = "select * from table_name " Set trecord = New ADODB . Trecord Recordset . Open SLCT , tconnection
End of vb code