VB 6.0 - MySQL Connection

This Tutorial Visual Basic 6.0 how to connect Database MySQL
  • Step 1: Create database and table in MySQL
  • Step 2 : Design form in VB 6.0

#Step 1 :
Open Xampp Control Panel
Please Make sure Apache and MySQL Runing
Create Database : MYDB
Create Table : tbl_product
Insert data in table : tbl_product

Click Control Panel in Your Computer
Search ODBC
Click ODBC
Click Add
Data Source Name : ConnectProduct
Server : Localhost
User : root
Database : MyDB
Click : OK

#Step 2 :
Open Visual Basic 6.0
Standard EXE - Open
Add component
Click Apply - OK
Design Form1 like below picture
save your project inside Folder VB6Access2003
click here for VB 6.0 - SQL Server Connection
and then place code below in form1 :
Dim Conn As New ADODB.Connection
Dim RSProduct As ADODB.Recordset
Sub OpenDB()
Set Conn = New ADODB.Connection
Set RSProduct = New ADODB.Recordset
Conn.Open "rovider=MSDASQL.1;Persist Security Info=False;Data Source=ConnectProduct "
End Sub
Private Sub Form_Load()
Call OpenDB
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = "tbl_product"
Set DataGrid1.DataSource = Adodc1
End Sub

Download Spurce Code Here


Subscribe to receive free email updates:

0 Response to "VB 6.0 - MySQL Connection"

Post a Comment