Kamis, 24 November 2011

Form 21

Public Class Form21
    Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim hxh1 As New DataTable
    Dim hxh2 As New DataTable
    Dim ima As New DataSet
    Dim op1 As New BindingSource
    Dim op2 As New BindingSource
    Private Sub Form21_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ami1 As New OleDb.OleDbDataAdapter
        Dim ami2 As New OleDb.OleDbDataAdapter
        ami1 = New OleDb.OleDbDataAdapter("select * from mastertransaksi", CONECT)
        ami1.Fill(hxh1)
        dgv1_021.DataSource = op1

        ami2 = New OleDb.OleDbDataAdapter("select * from detailtransaksi", CONECT)
        ami2.Fill(hxh2)
        dgv2_021.DataSource = op2

        ima.Tables.Add(hxh1)
        ima.Tables.Add(hxh2)

        hxh1.TableName = "sembarang1"
        hxh2.TableName = "sembarang2"

        ima.Relations.Add(New DataRelation("AA", ima.Tables("sembarang1").Columns("notrans"), ima.Tables("sembarang2").Columns("notrans")))

        op1.DataSource = ima
        op1.DataMember = "sembarang1"
        op2.DataSource = op1
        op2.DataMember = "AA"
    End Sub
End Class

Tidak ada komentar:

Posting Komentar