Jumat, 04 November 2011

Latihan 33 Apkom 4 D3 A

16 komentar:

  1. Public NotInheritable Class form33a_36109003
    Dim anto As New DataTable
    Dim antho As New OleDb.OleDbCommand
    Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")

    Private Sub tambah_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109003.Click
    If form33b_36109003.Visible = False Then
    form33b_36109003.Show()
    Else
    form33b_36109003.Activate()
    End If
    End Sub

    Private Sub edit_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109003.Click
    If form33b_36109003.Visible = False Then
    form33b_36109003.Show()
    Else
    form33b_36109003.Activate()
    End If
    form33b_36109003.kbl_36109003.Text = dgv_36109003.CurrentRow.Cells("kodebarang").Value
    form33b_36109003.kb_36109003.Text = dgv_36109003.CurrentRow.Cells("kodebarang").Value
    form33b_36109003.nb_36109003.Text = dgv_36109003.CurrentRow.Cells("namabarang").Value
    form33b_36109003.jb_36109003.Text = dgv_36109003.CurrentRow.Cells("jumlahbarang").Value
    form33b_36109003.hj_36109003.Text = dgv_36109003.CurrentRow.Cells("hargajual").Value
    End Sub

    Private Sub form33a_36109003_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim adapter As New OleDb.OleDbDataAdapter
    adapter = New OleDb.OleDbDataAdapter("select * from barang", ndut)
    anto.Rows.Clear()
    adapter.Fill(anto)
    adapter.Dispose()
    dgv_36109003.DataSource = anto
    End Sub

    Private Sub hapus_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_36109003.Click
    Dim soe As String = "delete * from barang where kodebarang = '" & dgv_36109003.CurrentRow.Cells("kodebarang").Value & "'"
    antho = New OleDb.OleDbCommand(soe, ndut)
    ndut.Open()
    antho.ExecuteNonQuery()
    ndut.Close()
    antho.Dispose()

    Dim adapter As New OleDb.OleDbDataAdapter
    adapter = New OleDb.OleDbDataAdapter("select * from barang", ndut)
    anto.Rows.Clear()
    adapter.Fill(anto)
    adapter.Dispose()
    dgv_36109003.DataSource = anto
    End Sub
    End Class

    BalasHapus
  2. Public NotInheritable Class form33b_36109003
    Dim arman As New ByIskandar.CariKeDataBaseByIskandar
    Dim anto As New OleDb.OleDbCommand
    Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If kbl_36109003.Text = "" Then
    arman.AturPencarianDataBase("Barang", "KodeBarang", kb_36109003.Text, 1, ndut)
    If arman.JumlanBaris > 0 Then
    MsgBox("kode barang telah ada")
    kb_36109003.Text = ""
    Exit Sub
    ElseIf kb_36109003.Text.Length = 0 Then
    MsgBox("kode barang harus tercantum")
    Exit Sub
    ElseIf nb_36109003.Text.Length = 0 Then
    MsgBox("nama barang harus tercantum")
    Exit Sub
    ElseIf hj_36109003.Text.Length = 0 Then
    MsgBox("harga jual harus tercantum")
    Exit Sub
    ElseIf jb_36109003.Text.Length = 0 Then
    MsgBox("jumlah barang harus tercantum")
    Exit Sub
    End If
    Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109003.Text & "','" & nb_36109003.Text & "'," & Val(hj_36109003.Text) & "," & Val(jb_36109003.Text) & ")"
    anto = New OleDb.OleDbCommand(soe, ndut)
    ndut.Open()
    anto.ExecuteNonQuery()
    ndut.Close()
    anto.Dispose()
    kb_36109003.Text = ""
    nb_36109003.Text = ""
    hj_36109003.Text = ""
    jb_36109003.Text = ""
    Else
    If kbl_36109003.Text <> kb_36109003.Text Then
    arman.AturPencarianDataBase("Barang", "KodeBarang", kb_36109003.Text, 1, ndut)
    If arman.JumlanBaris > 0 Then
    MsgBox("kode barang tidak dapat diupdate")
    Exit Sub
    End If
    End If
    If kb_36109003.Text.Length = 0 Then
    MsgBox("kode barang harus tercantum")
    Exit Sub
    ElseIf nb_36109003.Text.Length = 0 Then
    MsgBox("nama barang harus tercantum")
    Exit Sub
    ElseIf hj_36109003.Text.Length = 0 Then
    MsgBox("harga jual harus tercantum")
    Exit Sub
    ElseIf jb_36109003.Text.Length = 0 Then
    MsgBox("jumlah barang harus tercantum")
    Exit Sub
    End If
    Dim soe As String = "update barang set kodebarang = '" & kb_36109003.Text & "', namabarang = '" & nb_36109003.Text & "', hargajual = " & Val(hj_36109003.Text) & ", jumlahbarang = " & Val(jb_36109003.Text) & " where kodebarang = '" & kbl_36109003.Text & "'"
    anto = New OleDb.OleDbCommand(soe, ndut)
    ndut.Open()
    anto.ExecuteNonQuery()
    ndut.Close()
    anto.Dispose()
    kbl_36109003.Text = "-"
    kb_36109003.Text = ""
    nb_36109003.Text = ""
    hj_36109003.Text = ""
    jb_36109003.Text = ""
    End If
    End Sub
    End Class

    BalasHapus
  3. RUSNANINGSI R
    36109010

    http://rusnaningsi.blogspot.com/2011/11/latihan-31-33-apkom-4.html

    BalasHapus
  4. Ismi Febriani Asyikin
    3a D3
    361 09 005


    Public Class Latihan33B_36109005
    Dim ISMI As New ByIskandar.CariKeDataBaseByIskandar
    Dim OD As New OleDb.OleDbCommand
    Dim DB As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Private Sub Simpan_36109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_36109005.Click
    If KB_36109005.Text = "" Then
    ISMI.AturPencarianDataBase("Barang", "KodeBarang", t1_36109005.Text, 1, DB)
    If ISMI.JumlanBaris > 0 Then
    MsgBox("Masukkan teks")
    t1_36109005.Text = ""
    Exit Sub
    ElseIf t1_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t2_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t3_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t4_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    End If

    Dim ICHMI As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109005.Text & "','" & t2_36109005.Text & "'," & Val(t3_36109005.Text) & "," & Val(t4_36109005.Text) & ")"
    OD = New OleDb.OleDbCommand(ICHMI, DB)
    DB.Open()
    OD.ExecuteNonQuery()
    DB.Close()
    OD.Dispose()
    t1_36109005.Text = ""
    t2_36109005.Text = ""
    t3_36109005.Text = ""
    t4_36109005.Text = ""
    Else
    If KB_36109005.Text <> t1_36109005.Text Then
    ISMI.AturPencarianDataBase("Barang", "KodeBarang", t1_36109005.Text, 1, DB)
    If ISMI.JumlanBaris > 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    End If
    End If
    If t1_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t2_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t3_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    ElseIf t4_36109005.Text.Length = 0 Then
    MsgBox("Masukkan teks")
    Exit Sub
    End If

    Dim ICHMI As String = "update barang set kodebarang = '" & t1_36109005.Text & "', namabarang = '" & t2_36109005.Text & "', hargajual = " & Val(t3_36109005.Text) & ", jumlahbarang = " & Val(t4_36109005.Text) & " where kodebarang = '" & KB_36109005.Text & "'"
    OD = New OleDb.OleDbCommand(ICHMI, DB)
    DB.Open()
    OD.ExecuteNonQuery()
    DB.Close()
    OD.Dispose()
    KB_36109005.Text = "-"
    t1_36109005.Text = ""
    t2_36109005.Text = ""
    t3_36109005.Text = ""
    t4_36109005.Text = ""
    End If
    End Sub
    End Class

    BalasHapus
  5. Amelia Indahsari
    361 09 023

    http://heiamee.blogspot.com/search/label/campus

    BalasHapus
  6. Public Class Form33A
    Dim DIEGO As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.ACCDB")
    Dim SHARAPOVA As New DataTable

    Private Sub Form33A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    XXX()
    DGV014.DataSource = SHARAPOVA

    End Sub

    Private Sub TAMBAH014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH014.Click
    If Latihan33B_014.Visible = False Then
    Latihan33B_014.Show()
    Else
    Latihan33B_014.Activate()
    End If
    End Sub

    Public Sub XXX()
    Dim ADAPTER As New OleDb.OleDbDataAdapter
    ADAPTER = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", DIEGO)
    SHARAPOVA.Rows.Clear()

    ADAPTER.Fill(SHARAPOVA)
    ADAPTER.Dispose()
    End Sub

    Private Sub EDIT014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT014.Click
    If Latihan33B_014.Visible = False Then
    Latihan33B_014.Show()
    Else
    Latihan33B_014.Activate()
    End If

    Latihan33B_014.KBL014.Text = DGV014.CurrentRow.Cells("KODEBARANG").Value()
    Latihan33B_014.KB014.Text = DGV014.CurrentRow.Cells("KODEBARANG").Value
    Latihan33B_014.NB014.Text = DGV014.CurrentRow.Cells("NAMABARANG").Value
    Latihan33B_014.HJ014.Text = DGV014.CurrentRow.Cells("HARGAJUAL").Value
    Latihan33B_014.JB014.Text = DGV014.CurrentRow.Cells("JUMLAHBARANG").Value
    End Sub

    Private Sub HAPUS014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS014.Click
    Dim AAA As New OleDb.OleDbCommand
    AAA = New OleDb.OleDbCommand("DELETE* FROM BARANG WHERE KODEBARANG = '" & DGV014.CurrentRow.Cells("KODEBARANG").Value & "'", DIEGO)
    DIEGO.Open()
    AAA.ExecuteNonQuery()
    DIEGO.Close()
    AAA.Dispose()

    XXX()

    End Sub
    End Class

    BalasHapus
  7. Public Class Latihan33B_014
    Dim DIEGO As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.ACCDB")
    Private Sub TBH()
    Dim XXX As New ByIskandar.CariKeDataBaseByIskandar
    XXX.AturPencarianDataBase("BARANG", "KODEBARANG", KB014.Text, 1, DIEGO)
    If XXX.JumlanBaris > 0 Then
    MsgBox("KODE BARANG SUDAH ADA")
    Exit Sub
    End If

    Dim ABC As New OleDb.OleDbCommand
    ABC = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG) VALUES('" & KB014.Text & "','" & NB014.Text & "'," & Val(HJ014.Text) & "," & Val(JB014.Text) & ")", DIEGO)

    DIEGO.Open()
    ABC.ExecuteNonQuery()
    DIEGO.Close()
    ABC.Dispose()

    KBL014.Text = "-"
    KB014.Text = ""
    NB014.Text = ""
    HJ014.Text = ""
    JB014.Text = ""

    Form33A.XXX()
    End Sub
    Private Sub EDIT()
    If KBL014.Text <> KB014.Text Then
    Dim XXX As New ByIskandar.CariKeDataBaseByIskandar
    XXX.AturPencarianDataBase("BARANG", "KODEBARANG", KB014.Text, 1, DIEGO)
    If XXX.JumlanBaris > 0 Then
    MsgBox("KODE BARANG SUDAH ADA")
    Exit Sub
    End If
    End If

    Dim ABC As New OleDb.OleDbCommand
    ABC = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG = '" & KB014.Text & "', NAMABARANG = '" & NB014.Text & "', HARGAJUAL = " & Val(HJ014.Text) & ", JUMLAHBARANG = " & Val(JB014.Text) & " WHERE KODEBARANG = '" & KBL014.Text & "'", DIEGO)

    DIEGO.Open()
    ABC.ExecuteNonQuery()
    DIEGO.Close()
    ABC.Dispose()

    Form33A.XXX()
    If Form33A.Visible = False Then
    Form33A.Show()
    Else
    Form33A.Activate()
    End If

    KBL014.Text = "-"
    KB014.Text = ""
    NB014.Text = ""
    HJ014.Text = ""
    JB014.Text = ""

    End Sub


    Private Sub SIMPAN014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN014.Click
    If KB014.Text.Length = 0 Then
    MsgBox("MASUKKAN KODE BARANG")
    Exit Sub
    End If

    If NB014.Text.Length = 0 Then
    MsgBox("MASUKKAN NAMA BARANG")
    Exit Sub
    End If

    If Val(HJ014.Text) = 0 Then
    MsgBox("MASUKKAN HARGA JUAL")
    Exit Sub
    End If

    If Val(JB014.Text) = 0 Then
    MsgBox("MASUKKAN JUMLAH BARANG")
    Exit Sub
    End If

    If KBL014.Text = "-" Then
    TBH()
    Else
    EDIT()
    End If
    End Sub
    End Class

    BalasHapus
  8. Ismi Febriani Asyikin
    3a D3
    361 09 005

    http://ismifebriani.blogspot.com/2011/12/apkom-4-latihan-33.html

    BalasHapus
  9. HASTUTI
    36109016


    FORM33-B
    Public Class Form33_B
    Dim uthi As New ByIskandar.CariKeDataBaseByIskandar
    Dim poltek As New OleDb.OleDbCommand
    Dim ak As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub indonesia()
    If kode36109016.Text.Length = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If nama36109016.Text.Length = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If Val(harga36109016.Text) = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If Val(jumlah36109016.Text) = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If
    End Sub

    Private Sub tambah()
    indonesia()
    uthi.AturPencarianDataBase("Barang", "KodeBarang", kode36109016.Text, 1, ak)
    If uthi.JumlanBaris > 0 Then
    MsgBox("Adami kode barang seperti itu")
    Exit Sub
    End If

    poltek = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kode36109016.Text & "','" & nama36109016.Text & "'," & Val(harga36109016.Text) & "," & Val(jumlah36109016.Text) & ")", ak)
    ak.Open()
    poltek.ExecuteNonQuery()
    ak.Close()
    poltek.Dispose()

    kode36109016.Text = ""
    nama36109016.Text = ""
    harga36109016.Text = ""
    jumlah36109016.Text = ""

    Form33_A.uthi()
    End Sub

    Private Sub edit()
    indonesia()
    If kode36109016.Text <> KB36109016.Text Then
    uthi.AturPencarianDataBase("Barang", "KodeBarang", kode36109016.Text, 1, ak)
    If uthi.JumlanBaris > 0 Then
    MsgBox("Adami kode barang seperti itu")
    Exit Sub
    End If
    End If

    poltek = New OleDb.OleDbCommand("update barang set kodebarang = '" & kode36109016.Text & "', namabarang = '" & nama36109016.Text & "', hargajual = " & Val(harga36109016.Text) & ", jumlahbarang = " & Val(jumlah36109016.Text) & " where kodebarang = '" & KB36109016.Text & "'", ak)

    ak.Open()
    poltek.ExecuteNonQuery()
    ak.Close()
    poltek.Dispose()

    kode36109016.Text = ""
    nama36109016.Text = ""
    harga36109016.Text = ""
    jumlah36109016.Text = ""
    KB36109016.Text = "-"

    Form33_A.uthi()
    End Sub
    Private Sub simpan36109016_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109016.Click
    If KB36109016.Text = "-" Then
    tambah()
    Else
    edit()
    End If
    End Sub
    End Class

    BalasHapus
  10. Public Class Form33A_36109006
    Dim dt As New DataTable
    Dim rr As New OleDb.OleDbCommand
    Dim mhh006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub harun()
    Dim muhharun As New OleDb.OleDbDataAdapter
    muhharun = New OleDb.OleDbDataAdapter("select * from barang", mhh006)
    dt.Rows.Clear()
    muhharun.Fill(dt)
    muhharun.Dispose()
    End Sub

    Private Sub Latihan_33A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    harun()
    dgv_36109006.DataSource = dt
    End Sub

    Private Sub tambah_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109006.Click
    If Form33B_36109006.Visible = False Then
    Form33B_36109006.Show()
    Else
    Form33B_36109006.Activate()
    End If

    Form33B_36109006.kb1_36109006.Text = ""
    Form33B_36109006.nb_36109006.Text = ""
    Form33B_36109006.hj_36109006.Text = ""
    Form33B_36109006.jb_36109006.Text = ""
    Form33B_36109006.ee_36109006.Text = "-"
    End Sub

    Private Sub edit_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109006.Click
    If Form33B_36109006.Visible = False Then
    Form33B_36109006.Show()
    Else
    Form33B_36109006.Activate()
    End If

    Form33B_36109006.kb1_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
    Form33B_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
    Form33B_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
    Form33B_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
    Form33B_36109006.ee_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value

    Form33B_36109006.Show()
    End Sub
    Private Sub hapus_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_36109006.Click
    rr = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv_36109006.CurrentRow.Cells("kodebarang").Value & "'", mhh006)
    mhh006.Open()
    rr.ExecuteNonQuery()
    mhh006.Close()
    rr.Dispose()

    harun()

    End Sub


    End Class

    BalasHapus
  11. Public Class Form33B_36109006
    Dim harun As New ByIskandar.CariKeDataBaseByIskandar
    Dim rr As New OleDb.OleDbCommand
    Dim mhh As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub indonesia()
    If kb1_36109006.Text.Length = 0 Then
    MsgBox("Isi yang kosong")
    Exit Sub
    End If

    If nb_36109006.Text.Length = 0 Then
    MsgBox("Isi yang kosong")
    Exit Sub
    End If

    If Val(hj_36109006.Text) = 0 Then
    MsgBox("Isi yang kosong")
    Exit Sub
    End If

    If Val(jb_36109006.Text) = 0 Then
    MsgBox("Isi yang kosong")
    Exit Sub
    End If
    End Sub

    Private Sub tambah()
    indonesia()
    harun.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109006.Text, 1, mhh)
    If harun.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    rr = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb1_36109006.Text & "','" & nb_36109006.Text & "'," & Val(hj_36109006.Text) & "," & Val(jb_36109006.Text) & ")", mhh)
    mhh.Open()
    rr.ExecuteNonQuery()
    mhh.Close()
    rr.Dispose()

    kb1_36109006.Text = ""
    nb_36109006.Text = ""
    hj_36109006.Text = ""
    jb_36109006.Text = ""

    Form33A_36109006.harun()
    End Sub

    Private Sub edit()
    indonesia()
    If kb1_36109006.Text <> ee_36109006.Text Then
    harun.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109006.Text, 1, mhh)
    If harun.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    rr = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb1_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & ee_36109006.Text & "'", mhh)

    mhh.Open()
    rr.ExecuteNonQuery()
    mhh.Close()
    rr.Dispose()

    kb1_36109006.Text = ""
    nb_36109006.Text = ""
    hj_36109006.Text = ""
    jb_36109006.Text = ""
    ee_36109006.Text = "-"

    Form33A_36109006.harun()
    End Sub

    Private Sub save_36109006_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_36109006.Click
    If ee_36109006.Text = "-" Then
    tambah()
    Else
    edit()
    End If
    End Sub

    End Class

    BalasHapus
  12. Public Class Form33A_36109001
    Dim dt As New DataTable
    Dim rr As New OleDb.OleDbCommand
    Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub apreal()
    Dim apr As New OleDb.OleDbDataAdapter
    apr = New OleDb.OleDbDataAdapter("select * from barang", imps)
    dt.Rows.Clear()
    apr.Fill(dt)
    apr.Dispose()
    End Sub

    Private Sub Form33A_36109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    apreal()
    dgv_36109001.DataSource = dt
    End Sub

    Private Sub bb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2_36109001.Click
    If Form33B_36109001.Visible = False Then
    Form33B_36109001.Show()
    Else
    Form33B_36109001.Activate()
    End If

    Form33B_36109001.kb1_36109001.text = ""
    Form33B_36109001.nb_36109001.text = ""
    Form33B_36109001.hj_36109001.text = ""
    Form33B_36109001.jb_36109001.text = ""
    Form33B_36109001.ee.Text = "-"
    End Sub

    Private Sub cc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3_36109001.Click
    If Form33B_36109001.Visible = False Then
    Form33B_36109001.Show()
    Else
    Form33B_36109001.Activate()
    End If

    Form33B_36109001.kb1_36109001.text = dgv_36109001.CurrentRow.Cells("kodebarang").Value
    Form33B_36109001.nb_36109001.text = dgv_36109001.CurrentRow.Cells("namabarang").Value
    Form33B_36109001.hj_36109001.text = dgv_36109001.CurrentRow.Cells("hargajual").Value
    Form33B_36109001.jb_36109001.text = dgv_36109001.CurrentRow.Cells("jumlahbarang").Value
    Form33B_36109001.ee.text = dgv_36109001.CurrentRow.Cells("kodebarang").Value

    Form33B_36109001.Show()
    End Sub

    Private Sub aa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_36109001.Click
    rr = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv_36109001.CurrentRow.Cells("kodebarang").Value & "'", imps)
    imps.Open()
    rr.ExecuteNonQuery()
    imps.Close()
    rr.Dispose()

    apreal()
    End Sub

    Private Sub dgv_36109001_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_36109001.CellContentClick

    End Sub
    End Class

    BalasHapus
  13. Public Class Form33B_36109001
    Dim apreal As New ByIskandar.CariKeDataBaseByIskandar
    Dim rr As New OleDb.OleDbCommand
    Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub indonesia()
    If kb1_36109001.Text.Length = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If nb_36109001.Text.Length = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If Val(hj_36109001.Text) = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If

    If Val(jb_36109001.Text) = 0 Then
    MsgBox("Isi rong itu yang kosong")
    Exit Sub
    End If
    End Sub

    Private Sub tambah()
    indonesia()
    apreal.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109001.Text, 1, imps)
    If apreal.JumlanBaris > 0 Then
    MsgBox("Adami kode barang seperti itu")
    Exit Sub
    End If

    rr = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb1_36109001.Text & "','" & nb_36109001.Text & "'," & Val(hj_36109001.Text) & "," & Val(jb_36109001.Text) & ")", imps)
    imps.Open()
    rr.ExecuteNonQuery()
    imps.Close()
    rr.Dispose()

    kb1_36109001.Text = ""
    nb_36109001.Text = ""
    hj_36109001.Text = ""
    jb_36109001.Text = ""

    Form33A_36109001.apreal()
    End Sub

    Private Sub edit()
    indonesia()
    If kb1_36109001.Text <> ee.Text Then
    apreal.AturPencarianDataBase("Barang", "KodeBarang", kb1_36109001.Text, 1, imps)
    If apreal.JumlanBaris > 0 Then
    MsgBox("Adami kode barang seperti itu")
    Exit Sub
    End If
    End If

    rr = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb1_36109001.Text & "', namabarang = '" & nb_36109001.Text & "', hargajual = " & Val(hj_36109001.Text) & ", jumlahbarang = " & Val(jb_36109001.Text) & " where kodebarang = '" & ee.Text & "'", imps)

    imps.Open()
    rr.ExecuteNonQuery()
    imps.Close()
    rr.Dispose()

    kb1_36109001.Text = ""
    nb_36109001.Text = ""
    hj_36109001.Text = ""
    jb_36109001.Text = ""
    ee.Text = "-"

    Form33A_36109001.apreal()
    End Sub

    Private Sub ff_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt_36109001.Click
    If ee.Text = "-" Then
    tambah()
    Else
    edit()
    End If
    End Sub
    End Class

    BalasHapus
  14. ANDI WAHYUNI
    361 09 019
    http://wahyunistrongggg.blogspot.com/2011/11/latihan-33-34.html

    BalasHapus
  15. http://febriantysuryaningtyas.blogspot.com/2011/12/latihan-33.html

    BalasHapus
  16. iwan
    361 09 026
    3a-d3


    http://iwandinejad.blogspot.com/#!/2012/01/latihan-33a33b.html

    BalasHapus