Jumat, 16 Desember 2011

APKOM 4 (Latihan 43)

LATIHAN 43

Public Class Latihan43_36109005
    Dim ISMI As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\Data Grafik.accdb")
    Dim DT As New DataTable
    Private Sub Latihan43_36109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ICHMI As New OleDb.OleDbDataAdapter
        ICHMI = New OleDb.OleDbDataAdapter("select * from qpembelianperjenisbarang", ISMI)
        DT.Rows.Clear()
        ICHMI.Fill(DT)
        DGV_36109005.DataSource = DT

        ICHMI.Dispose()

        Grafik_36109005.ColumnCount = 3
        Grafik_36109005.RowCount = DT.Rows.Count

        Dim POSISIBARIS As Integer = 0

        For Each x As DataRow In DT.Rows
            POSISIBARIS = POSISIBARIS + 1
            Grafik_36109005.Row = POSISIBARIS

            Grafik_36109005.RowLabel = x("kode barang")

            Grafik_36109005.Column = 1
            Grafik_36109005.Data = x("unit")

            Grafik_36109005.Column = 2
            Grafik_36109005.Data = x("rata-rata harga") / 1000

            Grafik_36109005.Column = 3
            Grafik_36109005.Data = x("jumlah") / 10000
        Next
    End Sub
End Class

Tidak ada komentar:

Posting Komentar