a Microsoft Visual Basic 6.0 program for creating a connection in MS Visual Basic 6.0 to a MySQL database
►requirements:
MySQL ODBC Driver
- the MySQL database connector from MS Visual Basic
- Open Database Connectivity (ODBC)
►MS Visual Basic
Private Sub Form_Load()
On Error GoTo DBerror
db_name = "wawang"
db_server = "localhost"
db_port = "" 'default port is 3306
db_user = "root"
db_pass = ""
ConnServer ' Open with ODBC in Control Panel
Rx = 0
ShowData
ShowGrid
Exit Sub
DBerror:
ShowData
ShowGrid
End Sub
Private Sub ConnServer()
'connect to MySQL server using MySQL ODBC 3.51 Driver
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=localhost;" _
& " DATABASE=wawang;" _
& "UID=root;PWD=; OPTION=3"
conn.Open
End Sub
note:
wawang is the database name
  .  cdo bloggers   .  my digital corner   .  sacha chua   .  the oatmeal   .  toxel.com   . 
  .  Hotels & Resorts Worldwide   . 



