Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » Visual Basic 6.0 » Modul Koneksi VB 6 Driver MYSQL 5.1

Modul Koneksi VB 6 Driver MYSQL 5.1

Option Explicit
Public DBKoneksi As ADODB.Connection
Public Rs_Pegawai As ADODB.Recordset
Public Rs_Jabatan As ADODB.Recordset
Public Rs_Potongan As ADODB.Recordset
Public Rs_Tunjangan As ADODB.Recordset
Public Rs_Gapok As ADODB.Recordset
Public Rs_Golongan As ADODB.Recordset
Public Rs_Posisi As ADODB.Recordset
Public Rs_Keluarga As ADODB.Recordset
Public Rs_Penggajian As ADODB.Recordset
Public Rs_Presensi As ADODB.Recordset
Public Rs_Pendidikan As ADODB.Recordset

Public i As Byte
Public View As ListItem
Public StrKoneksi As String

‘ Perintah-perintah umum
Public SqlMasuk As String
Public SqlUbah As String
Public SqlHapus As String
Public Konfirmasi As String

Public Sub Bukadatabase()
Set DBKoneksi = New ADODB.Connection
DBKoneksi.CursorLocation = adUseClient

‘StrKoneksi = “Provider=Microsoft.Jet.OleDB.4.0; ” _
‘    & ” Data Source=” + App.Path _
‘    + “\DbPenggajian.mdb;Mode=readwrite”

‘StrKoneksi = “provider=msdasql.1;” & _
‘”persist security info = false; data source = sdmkumham;” & _
‘”initial catalog = sdmkumham”

StrKoneksi = “Driver={MySQL ODBC 5.1 Driver}; SERVER=localhost;PWD=okedeh;UID=root;port=3306;DATABASE=sdmkumham;”

If DBKoneksi.State = adStateOpen Then
DBKoneksi.Close
Set DBKoneksi = New ADODB.Connection
DBKoneksi.Open StrKoneksi
Else
DBKoneksi.Open StrKoneksi
End If
End Sub

Filed under: Visual Basic 6.0

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>