Skip to content

Instantly share code, notes, and snippets.

@galihboy
Created November 6, 2021 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galihboy/267b82956f90d20be32fbe9e33f8497d to your computer and use it in GitHub Desktop.
Save galihboy/267b82956f90d20be32fbe9e33f8497d to your computer and use it in GitHub Desktop.
vb6 mysql 01
Option Explicit
' Koneksi VB6 & MySQL/MariaDB
' Developed by Galih Hermawan
' https://galih.eu
Dim koneksi As MYSQL_CONNECTION
Private Sub Command1_Click()
Set koneksi = New MYSQL_CONNECTION
Const host = "localhost"
Const user = "root"
Const passw = ""
Const port = 3306
koneksi.OpenConnection host, user, passw, , port
If koneksi.State = MY_CONN_OPEN Then
Dim status
Dim isi
Set status = koneksi.Execute("SELECT version()")
isi = status.GetString(, "")
MsgBox "Koneksi sukses! Versi database: " + isi, vbInformation, "Sukses!"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set koneksi = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment