Created
November 6, 2021 10:47
-
-
Save galihboy/267b82956f90d20be32fbe9e33f8497d to your computer and use it in GitHub Desktop.
vb6 mysql 01
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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