bikin class atau modulll
untuk koneksi acces 2007
trus copykan script ini
Imports System.Data.OleDb
Public Class KONEKSI
Public CN As New ADODB.Connection
Private dbPath As String = Application.StartupPath + "\poeNx.accdb" '----> taruh lokasi file di folder debug
Sub poeNx()
Try
CN = New ADODB.Connection
CN.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath & "; Persist Security Info = False;"
CN.Open()
'MsgBox("Koneksi sukses")
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Koneksi Bermasalah")
Exit Sub
End Try
End Sub
End Class
-----------------------------
di setiap form
ketikan ini di bg paling atas
Imports System.Data.OleDb
Public Class Form1'==============> form 1 adalah nama Form
Public ANGGIL As New KONEKSI
trus dibagian event Load ketikan script berikut
PANGGIL.poeNx()

Comments :
0 komentar to “koneksi vb dot net”
Posting Komentar