CLICK HERE FOR BLOGGER TEMPLATES AND MYSPACE LAYOUTS »

Selasa, 28 Juli 2009

Membuat fungsi koneksi ke database Ms Access di vb, berikut contohnya

Code:
Function Konek()
As Boolean On Error GoTo out
Set koneksi = New ADODB.Connection
koneksi. Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\toko.mdb;Persist Security Info=False"
koneksi.CursorLocation = adUseClient
Konek = True
out:
End Function


cara menggunakannya contoh

Code:

Private Sub Form_Load()
If Not Konek() Then
MsgBox "Gagal koneksi ke database!", vbCritical
End
End If
End Sub

0 komentar: