Total Pageviews

Labels

Seacrh By Labels

Contact Form

Name

Email *

Message *

Friday, 26 October 2018

Module Visual Studio 2010


1. Klik kana di Project File - Add - Module
2. Klik Module - add
3. Masukan kodingan berikut:

Imports System.Data.OleDb

Module Module1

    Public Conn As OleDbConnection
    Public Conn2 As OleDbConnection
    Public DA As OleDbDataAdapter
    Public DS As DataSet
    Public LokasiDB As String

    Private Property BarangTableAdapter As Object
    Public Sub Buka_Koneksi()
        LokasiDB = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\latihan\penjualan.accdb"
        Conn = New OleDbConnection(LokasiDB)
        If Conn.State = ConnectionState.Closed Then Conn.Open()

    End Sub

    Public Sub Buka_Conn2()
        Conn2 = New OleDbConnection
        Conn2.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\latihan\penjualan.accdb"
        Try
            If Conn2.State = ConnectionState.Open Then Conn2.Close()
            Conn2.Open()
        Catch Gagal As Exception
            MessageBox.Show(Gagal.Message, "Peringatan", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

        End Try

    End Sub

End Module

0 komentar:

Post a Comment