Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data.OleDb
- Imports System.Data
- Imports Access = Microsoft.Office.Interop.Access
- Imports Microsoft.Office
- Public Class Form5
- Dim oledbKoneksi As OleDbConnection = New OleDbConnection
- Dim oledbPerintah As OleDbCommand = New OleDbCommand
- Dim lokasiFile As String = "D:\fileAccess\"
- Dim namaFile As String = "Database1.accdb"
- Dim stringKoneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & lokasiFile & namaFile & ";" & "Persist Security Info=False;"
- Dim adapter As New OleDbDataAdapter
- ' Dim nomerID As String = CStr(TextBox1.Text)
- Sub tampilIsiGrid()
- oledbKoneksi.ConnectionString = stringKoneksi
- oledbKoneksi.Open()
- oledbPerintah.Connection = oledbKoneksi
- 'oledbPerintah.CommandText = "SELECT * FROM kueriDataPembelian WHERE idpembelian = 'DPL0001'"
- oledbPerintah.CommandText = "SELECT * FROM kueriDataPembelian"
- adapter.SelectCommand = oledbPerintah
- Dim ds As DataSet
- ds = New DataSet
- adapter.Fill(ds)
- DataGridView1.DataSource = ds.Tables(0)
- oledbKoneksi.Close()
- End Sub
- Private Sub Form5_Load(sender As Object, e As System.EventArgs) Handles Me.Load
- tampilIsiGrid()
- End Sub
- Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
- ' nomerID = CStr(TextBox1.Text)
- Dim nomerID As String = CStr(TextBox1.Text)
- Dim MSA As New Access.Application
- MSA.Visible = True
- MSA.OpenCurrentDatabase("D:\fileAccess\Database1.accdb")
- ' MSA.Application.DoCmd.OpenReport("reportDataPembelian2", Access.AcView.acViewPreview, "idpembelian = " & nomerID)
- MSA.Application.DoCmd.OpenReport("reportDataPembelian2", Access.AcView.acViewPreview, , "idpembelian = '" & nomerID & "'")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement