Saturday, January 21, 2012

latihan 41-44

Public Class LATIHAN41_36109013
    Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATA GRAFIK.accdb;jet OLEDB:database password=nhunoe")
    Dim DT As New DataTable
  
    Private Sub LATIHAN41_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fany As New OleDb.OleDbDataAdapter
        fany = New OleDb.OleDbDataAdapter("select * from KEUANGAN", CONECT)
        DT.Rows.Clear()
        fany.Fill(DT)
        dgv36109013.DataSource = DT

        fany.Dispose()
        grafik36109013.ColumnCount = 2
        grafik36109013.RowCount = DT.Rows.Count

        Dim POSISIBARIS As Integer = 0

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

            grafik36109013.RowLabel = x("tahun")

            grafik36109013.Column = 1
            grafik36109013.Data = x("PENDAPATAN") / 1000

            grafik36109013.Column = 2
            grafik36109013.Data = x("BIAYA") / 1000
        Next
    End Sub
End Class



Public Class LATIHAN42_36109013
    Dim fah As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Data Grafik.accdb")
    Dim dt As New DataTable

    Private Sub LATIHAN42_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As New OleDb.OleDbDataAdapter
        a = New OleDb.OleDbDataAdapter("select * from QRekapPerRekening", fah)
        dt.Rows.Clear()
        a.Fill(dt)
        a.Dispose()

        DGV36109013.DataSource = dt

        grafik36109013.ColumnCount = 2
        grafik36109013.RowCount = dt.Rows.Count

        Dim fany As Integer = 0
        For Each x As DataRow In dt.Rows
            fany += 1

            grafik36109013.Row = fany
            grafik36109013.RowLabel = x("koderekening")

            grafik36109013.Column = 1
            grafik36109013.Data = x("total debet") / 1000

            grafik36109013.Column = 2
            grafik36109013.Data = x("total kredit") / 1000
        Next
    End Sub
End Class

Public Class LATIHAN43_36109013
    Dim fah 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_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As New OleDb.OleDbDataAdapter
        a = New OleDb.OleDbDataAdapter("select * from qpembelianperjenisbarang", fah)
        dt.Rows.Clear()
        a.Fill(dt)
        a.Dispose()

        DGV36109013.DataSource = dt

        grafik36109013.ColumnCount = 3
        grafik36109013.RowCount = dt.Rows.Count

        Dim fany As Integer = 0
        For Each x As DataRow In dt.Rows
            fany += 1

            grafik36109013.Row = fany
            grafik36109013.RowLabel = x("kode barang")

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

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

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

Public Class LATIHAN44_36109013
    Dim fah As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/DATA GRAFIK.ACCDB")
    Dim dt As New DataTable

    Private Sub LATIHAN44_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As New OleDb.OleDbDataAdapter
        a = New OleDb.OleDbDataAdapter("select * from qpembelianperjenisbarang", fah)
        dt.Rows.Clear()
        a.Fill(dt)
        a.Dispose()

        DGV36109013.DataSource = dt

        grafik36109013.ColumnCount = 3
        grafik36109013.RowCount = dt.Rows.Count

        Dim fany As Integer = 0
        For Each x As DataRow In dt.Rows
            fany += 1

            grafik36109013.Row = fany
            grafik36109013.RowLabel = x("kode barang")

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

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

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

No comments:

Post a Comment