Public Class LATIHAN033A084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable Public Sub Deriel() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub Private Sub LATIHAN033A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Deriel() dgv_084.DataSource = datatabel1 End Sub
Private Sub tambah_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_084.Click If LATIHAN033B084.Visible = False Then LATIHAN033B084.Show() Else LATIHAN033B084.Activate() End If
LATIHAN033B084.Show() LATIHAN033B084.kb1_084.Text = "-" LATIHAN033B084.kb_084.Text = "" LATIHAN033B084.nb_084.Text = "" LATIHAN033B084.hj_084.Text = "" LATIHAN033B084.jb_084.Text = "" End Sub
Private Sub edit_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_084.Click If LATIHAN033B084.Visible = False Then LATIHAN033B084.Show() Else LATIHAN033B084.Activate() End If
LATIHAN033B084.Show() LATIHAN033B084.kb1_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value LATIHAN033B084.kb_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value LATIHAN033B084.nb_084.Text = dgv_084.CurrentRow.Cells("Namabarang").Value LATIHAN033B084.hj_084.Text = dgv_084.CurrentRow.Cells("Hargajual").Value LATIHAN033B084.jb_084.Text = dgv_084.CurrentRow.Cells("Jumlahbarang").Value End Sub
Private Sub hps_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_084.Click Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & dgv_084.CurrentRow.Cells("KODEBARANG").Value & "'", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Public Class LATIHAN033B084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_insert() If kb1_084.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb_084.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb_084.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(hj_084.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(jb_084.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If kb1_084.Text <> kb_084.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CMT As New OleDb.OleDbCommand CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_084.Text & "', '" & nb_084.Text & "', " & Val(hj_084.Text) & ", " & Val(jb_084.Text) & ")", A) A.Open() CMT.ExecuteNonQuery() A.Close() CMT.Dispose()
LATIHAN033A084.Deriel() End Sub Private Sub SIMPAN_UPDATE() If kb1_084.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb_084.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb_084.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(hj_084.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(jb_084.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If kb1_084.Text <> kb_084.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb_084.Text & "', NAMABARANG= '" & nb_084.Text & "', HARGAJUAL= " & Val(hj_084.Text) & ", JUMLAHBARANG= " & Val(jb_084.Text) & " WHERE KODEBARANG='" & kb1_084.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose()
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click If kb1_084.Text = "-" Then SIMPAN_insert() Else SIMPAN_UPDATE() End If End Sub End Class
Public Class Form33A Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub feby() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load feby() DGV_064.DataSource = datatabel1 End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click If Form33B.Visible = False Then Form33B.Show() Else Form33B.Activate() End If
Form33B.Show() Form33B.KBrg1.Text = "-" Form33B.KB_064.Text = "" Form33B.NB_064.Text = "" Form33B.HJ_064.Text = "" Form33B.JB_064.Text = "" End Sub End Class
Public Class Form33B Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KB_064.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_064.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(HJ_064.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JB_064.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> KB_064.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CMT As New OleDb.OleDbCommand CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_064.Text & "', '" & NB_064.Text & "', " & Val(HJ_064.Text) & ", " & Val(JB_064.Text) & ")", A) A.Open() CMT.ExecuteNonQuery() A.Close() CMT.Dispose()
Private Sub SIMPAN_UPDATE() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KB_064.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_064.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(HJ_064.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JB_064.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> KB_064.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_064.Text & "', NAMABARANG= '" & NB_064.Text & "', HARGAJUAL= " & Val(HJ_064.Text) & ", JUMLAHBARANG= " & Val(JB_064.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose()
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KBrg1.Text = "-" Then SIMPAN_INSERT() Else SIMPAN_UPDATE() End If End Sub
Public Class Form33A Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub PUTRA() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load PUTRA() DGV_076.DataSource = datatabel1 End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click If Form33B.Visible = False Then Form33B.Show() Else Form33B.Activate() End If
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click If Form33B.Visible = False Then Form33B.Show() Else Form33B.Activate() End If
Form33B.Show() Form33B.KBrg1.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value Form33B.KB_076.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value Form33B.NB_076.Text = DGV_076.CurrentRow.Cells("Namabarang").Value Form33B.HJ_076.Text = DGV_076.CurrentRow.Cells("Hargajual").Value Form33B.JB_076.Text = DGV_076.CurrentRow.Cells("Jumlahbarang").Value End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DGV_076.CurrentRow.Cells("KODEBARANG").Value & "'", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Public Class Form33B Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KB_076.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_076.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(HJ_076.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JB_076.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> KB_076.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CMT As New OleDb.OleDbCommand CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_076.Text & "', '" & NB_076.Text & "', " & Val(HJ_076.Text) & ", " & Val(JB_076.Text) & ")", A) A.Open() CMT.ExecuteNonQuery() A.Close() CMT.Dispose()
Private Sub SIMPAN_UPDATE() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KB_076.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_076.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(HJ_076.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JB_076.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> KB_076.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_076.Text & "', NAMABARANG= '" & NB_076.Text & "', HARGAJUAL= " & Val(HJ_076.Text) & ", JUMLAHBARANG= " & Val(JB_076.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose()
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KBrg1.Text = "-" Then SIMPAN_INSERT() Else SIMPAN_UPDATE() End If End Sub End Class
Public Class Latihan33B_071 Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB") Private Sub tambah() 'deklarasi object command Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_071.Text & "','" & nb_071.Text & "', " & Val(hj_071.Text) & "," & Val(jb_071.Text) & ")", go) go.Open() Cm.ExecuteNonQuery() go.Close() Cm.Dispose()
'mengambildata Latihan33A_071.ambildata() End Sub Private Sub ganti() 'deklarasi object command Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("Update BARANG set kodebarang ='" & kb_071.Text & "', namabarang = '" & nb_071.Text & "', hargajual=" & Val(hj_071.Text) & ", jumlahbarang=" & Val(jb_071.Text) & " where kodebarang='" & kbl_071.Text & "'", go) go.Open() Cm.ExecuteNonQuery() go.Close() Cm.Dispose()
'mengambildata Latihan33A_071.ambildata() End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'perintah periksa data If kb_071.Text.Length = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If nb_071.Text.Length = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If Val(hj_071.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If Val(jb_071.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
'perintah ambil data Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data")
'mengosongkan text box kb_071.Text = "" nb_071.Text = "" hj_071.Text = "" jb_071.Text = "" Exit Sub End If
If kbl_071.Text = "-" Then tambah() Else ganti() End If
Public Class LATIHAN033B068 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Private Sub SIMPAN_UPDATE() If kb1068.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If If kb068.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If If nb068.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If If Val(hj068.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If If Val(jb068.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If If kb1068.Text <> kb068.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb068.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb068.Text & "', NAMABARANG= '" & nb068.Text & "', HARGAJUAL= " & Val(hj068.Text) & ", JUMLAHBARANG= " & Val(jb068.Text) & " WHERE KODEBARANG='" & kb1068.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose() kb1068.Text = "-" kb068.Text = "" nb068.Text = "" hj068.Text = "" jb068.Text = "" LATIHAN033A068.asni() End Sub Private Sub SIMPAN_INSERT() If kb1068.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If If kb068.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If If nb068.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If If Val(hj068.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(jb068.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If If kb1068.Text <> kb068.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb068.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb068.Text & "', NAMABARANG= '" & nb068.Text & "', HARGAJUAL= " & Val(hj068.Text) & ", JUMLAHBARANG= " & Val(jb068.Text) & " WHERE KODEBARANG='" & kb1068.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose() kb1068.Text = "-" kb068.Text = "" nb068.Text = "" hj068.Text = "" jb068.Text = "" LATIHAN033A068.asni() End Sub Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click If kb1068.Text = "-" Then SIMPAN_INSERT() Else SIMPAN_UPDATE() End If End Sub End Class
Public Class Latihan33B Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb070.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb070.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(hj070.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(jb070.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> kb070.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CMT As New OleDb.OleDbCommand CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb070.Text & "', '" & nb070.Text & "', " & Val(hj070.Text) & ", " & Val(jb070.Text) & ")", A) A.Open() CMT.ExecuteNonQuery() A.Close() CMT.Dispose()
Private Sub Simpan_UPDATE() If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb070.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb070.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(hj070.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(jb070.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> kb070.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb070.Text & "', NAMABARANG= '" & nb070.Text & "', HARGAJUAL= " & Val(hj070.Text) & ", JUMLAHBARANG= " & Val(jb070.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A) A.Open() CME.ExecuteNonQuery() A.Close() CME.Dispose()
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KBrg1.Text = "-" Then SIMPAN_INSERT() Else SIMPAN_UPDATE() End If End Sub End Class
Public Class Form33B Dim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data source=" & Application.StartupPath & "\DATABARANG.accdb") Private Sub insert() If KB.Text.Length = 0 Then MsgBox("kode barang sudah ada") Exit Sub End If
If c1.Text.Length = 0 Then MsgBox("kode barang sudah ada") Exit Sub End If
If c2.Text.Length = 0 Then MsgBox("nama barang sudah ada") Exit Sub End If
If Val(c3.Text) = 0 Then MsgBox("harga barang sudah ada") Exit Sub End If
If Val(c4.Text) = 0 Then MsgBox("jumlah barang sudah ada") Exit Sub End If
If KB.Text <> c1.Text Then Dim cari As New ByIskandar.CariKeDataBaseByIskandar cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I) If cari.JumlanBaris > 0 Then MsgBox("kode barang sudah ada") Exit Sub End If End If
Dim JKL As New OleDb.OleDbCommand JKL = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', " & Val(c3.Text) & ", " & Val(c4.Text) & ")", I) I.Open() JKL.ExecuteNonQuery() I.Close() JKL.Dispose()
End Sub Private Sub SIMPAN_UPDATE() If KB.Text.Length = 0 Then MsgBox("kode barang sudah ada") Exit Sub End If
If c1.Text.Length = 0 Then MsgBox("kode barang sudah ada") Exit Sub End If
If c2.Text.Length = 0 Then MsgBox("nama barang sudah ada") Exit Sub End If
If Val(c3.Text) = 0 Then MsgBox("harga jual sudah ada") Exit Sub End If
If Val(c4.Text) = 0 Then MsgBox("jumlah barang suda ada") Exit Sub End If
If KB.Text <> c1.Text Then Dim cari As New ByIskandar.CariKeDataBaseByIskandar cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I) If cari.JumlanBaris > 0 Then MsgBox("kode barang sudah ada") Exit Sub End If End If
Dim ASD As New OleDb.OleDbCommand ASD = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & c1.Text & "', NAMABARANG= '" & c2.Text & "', HARGAJUAL= " & Val(c3.Text) & ", JUMLAHBARANG= " & Val(c4.Text) & " WHERE KODEBARANG='" & KB.Text & "'", I) I.Open() ASD.ExecuteNonQuery() I.Close() ASD.Dispose()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If KB.Text = "-" Then insert() Else SIMPAN_UPDATE()
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub IA() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", n) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load IA() DGV33A.DataSource = datatabel1 End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click If Latihan033B077.Visible = False Then Latihan033B077.Show() Else Latihan033B077.Activate() End If
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click If Latihan033B077.Visible = False Then Latihan033B077.Show() Else Latihan033B077.Activate() End If
Latihan033B077.Show() Latihan033B077.KBrg1077.Text = DGV33A.CurrentRow.Cells("Kodebarang").Value Latihan033B077.KBrg077.Text = DGV33A.CurrentRow.Cells("Kodebarang").Value Latihan033B077.NBrg077.Text = DGV33A.CurrentRow.Cells("Namabarang").Value Latihan033B077.HJual077.Text = DGV33A.CurrentRow.Cells("Hargajual").Value Latihan033B077.JBrg077.Text = DGV33A.CurrentRow.Cells("Jumlahbarang").Value End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DGV33A.CurrentRow.Cells("KODEBARANG").Value & "'", n) n.Open() CM.ExecuteNonQuery() n.Close() CM.Dispose()
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT() If KBrg1077.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KBrg077.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NBrg077.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(Hjual077.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JBrg077.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1077.Text <> KBrg077.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CMT As New OleDb.OleDbCommand CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KBrg077.Text & "', '" & NBrg077.Text & "', " & Val(Hjual077.Text) & ", " & Val(JBrg077.Text) & ")", n) n.Open() CMT.ExecuteNonQuery() n.Close() CMT.Dispose()
Private Sub SIMPAN_UPDATE() If KBrg1077.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KBrg077.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NBrg077.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(Hjual077.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JBrg077.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1077.Text <> KBrg077.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CME As New OleDb.OleDbCommand CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KBrg077.Text & "', NAMABARANG= '" & NBrg077.Text & "', HARGAJUAL= " & Val(Hjual077.Text) & ", JUMLAHBARANG= " & Val(JBrg077.Text) & " WHERE KODEBARANG='" & KBrg1077.Text & "'", n) n.Open() CME.ExecuteNonQuery() n.Close() CME.Dispose()
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KBrg1077.Text = "-" Then SIMPAN_INSERT() Else SIMPAN_UPDATE() End If End Sub End Class
Private Sub Save_082_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_082.Click If KB_082.Text = "-" Then Save_082_INSERT() Else Save_082_UPDATE() End If End Sub
Private Sub Form33B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Public Class latihan_33a Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=nideria") Dim cari As New DataTable
Public Sub danang() Dim adap As New OleDb.OleDbDataAdapter adap = New OleDb.OleDbDataAdapter("select * from barang", conect) cari.Rows.Clear() adap.Fill(cari) adap.Dispose()
End Sub
Private Sub latihan_33a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load danang() dgv.DataSource = cari End Sub
Private Sub Button2069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2069.Click If latihan_33b.Visible = False Then latihan_33b.Show() Else latihan_33b.Activate() End If
End Sub
Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click If latihan_33b.Visible = False Then latihan_33b.Show() Else latihan_33b.Activate() End If
Private Sub Button3069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3069.Click Dim prayudha As New OleDb.OleDbCommand prayudha = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & dgv.CurrentRow.Cells("KODEBARANG").Value & "'", conect) conect.Open() prayudha.ExecuteNonQuery() conect.Close() prayudha.Dispose()
danang()
End Sub End Class
Public Class latihan_33b Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=nideria") Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click If kobar069.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If nabar069.Text.Length = 0 Then MsgBox("nama barang belum terisi") Exit Sub End If
If Val(harju069.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If
If Val(jubar069.Text) = 0 Then MsgBox("jumlah barang") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into barang(kodebarang,namabarang,hargajual,jumlahbarang) Values('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", conect)
FITRAH ADITYA
BalasHapusPublic Class LATIHAN033A084
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub Deriel()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub LATIHAN033A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Deriel()
dgv_084.DataSource = datatabel1
End Sub
Private Sub tambah_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_084.Click
If LATIHAN033B084.Visible = False Then
LATIHAN033B084.Show()
Else
LATIHAN033B084.Activate()
End If
LATIHAN033B084.Show()
LATIHAN033B084.kb1_084.Text = "-"
LATIHAN033B084.kb_084.Text = ""
LATIHAN033B084.nb_084.Text = ""
LATIHAN033B084.hj_084.Text = ""
LATIHAN033B084.jb_084.Text = ""
End Sub
Private Sub edit_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_084.Click
If LATIHAN033B084.Visible = False Then
LATIHAN033B084.Show()
Else
LATIHAN033B084.Activate()
End If
LATIHAN033B084.Show()
LATIHAN033B084.kb1_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
LATIHAN033B084.kb_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
LATIHAN033B084.nb_084.Text = dgv_084.CurrentRow.Cells("Namabarang").Value
LATIHAN033B084.hj_084.Text = dgv_084.CurrentRow.Cells("Hargajual").Value
LATIHAN033B084.jb_084.Text = dgv_084.CurrentRow.Cells("Jumlahbarang").Value
End Sub
Private Sub hps_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_084.Click
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & dgv_084.CurrentRow.Cells("KODEBARANG").Value & "'", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
Deriel()
End Sub
End Class
Public Class LATIHAN033B084
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_insert()
If kb1_084.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb_084.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb_084.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj_084.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb_084.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If kb1_084.Text <> kb_084.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CMT As New OleDb.OleDbCommand
CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_084.Text & "', '" & nb_084.Text & "', " & Val(hj_084.Text) & ", " & Val(jb_084.Text) & ")", A)
A.Open()
CMT.ExecuteNonQuery()
A.Close()
CMT.Dispose()
kb1_084.Text = "-"
kb_084.Text = ""
nb_084.Text = ""
hj_084.Text = ""
jb_084.Text = ""
LATIHAN033A084.Deriel()
End Sub
Private Sub SIMPAN_UPDATE()
If kb1_084.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb_084.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb_084.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj_084.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb_084.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If kb1_084.Text <> kb_084.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb_084.Text & "', NAMABARANG= '" & nb_084.Text & "', HARGAJUAL= " & Val(hj_084.Text) & ", JUMLAHBARANG= " & Val(jb_084.Text) & " WHERE KODEBARANG='" & kb1_084.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
kb1_084.Text = "-"
kb_084.Text = ""
nb_084.Text = ""
hj_084.Text = ""
jb_084.Text = ""
LATIHAN033A084.Deriel()
End Sub
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
If kb1_084.Text = "-" Then
SIMPAN_insert()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
feby winriani syam
BalasHapusPublic Class Form33A
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub feby()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
feby()
DGV_064.DataSource = datatabel1
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
Form33B.Show()
Form33B.KBrg1.Text = "-"
Form33B.KB_064.Text = ""
Form33B.NB_064.Text = ""
Form33B.HJ_064.Text = ""
Form33B.JB_064.Text = ""
End Sub
End Class
Public Class Form33B
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KB_064.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_064.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(HJ_064.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JB_064.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> KB_064.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CMT As New OleDb.OleDbCommand
CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_064.Text & "', '" & NB_064.Text & "', " & Val(HJ_064.Text) & ", " & Val(JB_064.Text) & ")", A)
A.Open()
CMT.ExecuteNonQuery()
A.Close()
CMT.Dispose()
KBrg1.Text = "-"
KB_064.Text = ""
NB_064.Text = ""
HJ_064.Text = ""
JB_064.Text = ""
Form33A.feby()
End Sub
Private Sub SIMPAN_UPDATE()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KB_064.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_064.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(HJ_064.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JB_064.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> KB_064.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_064.Text & "', NAMABARANG= '" & NB_064.Text & "', HARGAJUAL= " & Val(HJ_064.Text) & ", JUMLAHBARANG= " & Val(JB_064.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
KBrg1.Text = "-"
KB_064.Text = ""
NB_064.Text = ""
HJ_064.Text = ""
JB_064.Text = ""
Form33A.feby()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KBrg1.Text = "-" Then
SIMPAN_INSERT()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Public Class Form33A
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub PUTRA()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PUTRA()
DGV_076.DataSource = datatabel1
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
Form33B.Show()
Form33B.KBrg1.Text = "-"
Form33B.KB_076.Text = ""
Form33B.NB_076.Text = ""
Form33B.HJ_076.Text = ""
Form33B.JB_076.Text = ""
End Sub
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
Form33B.Show()
Form33B.KBrg1.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value
Form33B.KB_076.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value
Form33B.NB_076.Text = DGV_076.CurrentRow.Cells("Namabarang").Value
Form33B.HJ_076.Text = DGV_076.CurrentRow.Cells("Hargajual").Value
Form33B.JB_076.Text = DGV_076.CurrentRow.Cells("Jumlahbarang").Value
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DGV_076.CurrentRow.Cells("KODEBARANG").Value & "'", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
PUTRA()
End Sub
End Class
Public Class Form33B
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KB_076.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_076.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(HJ_076.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JB_076.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> KB_076.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CMT As New OleDb.OleDbCommand
CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_076.Text & "', '" & NB_076.Text & "', " & Val(HJ_076.Text) & ", " & Val(JB_076.Text) & ")", A)
A.Open()
CMT.ExecuteNonQuery()
A.Close()
CMT.Dispose()
KBrg1.Text = "-"
KB_076.Text = ""
NB_076.Text = ""
HJ_076.Text = ""
JB_076.Text = ""
Form33A.PUTRA()
End Sub
Private Sub SIMPAN_UPDATE()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KB_076.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_076.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(HJ_076.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JB_076.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> KB_076.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_076.Text & "', NAMABARANG= '" & NB_076.Text & "', HARGAJUAL= " & Val(HJ_076.Text) & ", JUMLAHBARANG= " & Val(JB_076.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
KBrg1.Text = "-"
KB_076.Text = ""
NB_076.Text = ""
HJ_076.Text = ""
JB_076.Text = ""
Form33A.PUTRA()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KBrg1.Text = "-" Then
SIMPAN_INSERT()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Public Class Latihan33B_071
BalasHapusDim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
Private Sub tambah()
'deklarasi object command
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_071.Text & "','" & nb_071.Text & "', " & Val(hj_071.Text) & "," & Val(jb_071.Text) & ")", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
'mengambildata
Latihan33A_071.ambildata()
End Sub
Private Sub ganti()
'deklarasi object command
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("Update BARANG set kodebarang ='" & kb_071.Text & "', namabarang = '" & nb_071.Text & "', hargajual=" & Val(hj_071.Text) & ", jumlahbarang=" & Val(jb_071.Text) & " where kodebarang='" & kbl_071.Text & "'", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
'mengambildata
Latihan33A_071.ambildata()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'perintah periksa data
If kb_071.Text.Length = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If nb_071.Text.Length = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(hj_071.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(jb_071.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
'perintah ambil data
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
'mengosongkan text box
kb_071.Text = ""
nb_071.Text = ""
hj_071.Text = ""
jb_071.Text = ""
Exit Sub
End If
If kbl_071.Text = "-" Then
tambah()
Else
ganti()
End If
'mengosongkan text box
kb_071.Text = ""
nb_071.Text = ""
hj_071.Text = ""
jb_071.Text = ""
'menutup form
Me.Close()
End Sub
End Class
Public Class LATIHAN033B068
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_UPDATE()
If kb1068.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb068.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb068.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj068.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb068.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If kb1068.Text <> kb068.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb068.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb068.Text & "', NAMABARANG= '" & nb068.Text & "', HARGAJUAL= " & Val(hj068.Text) & ", JUMLAHBARANG= " & Val(jb068.Text) & " WHERE KODEBARANG='" & kb1068.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
kb1068.Text = "-"
kb068.Text = ""
nb068.Text = ""
hj068.Text = ""
jb068.Text = ""
LATIHAN033A068.asni()
End Sub
Private Sub SIMPAN_INSERT()
If kb1068.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb068.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb068.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj068.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb068.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If kb1068.Text <> kb068.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb068.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb068.Text & "', NAMABARANG= '" & nb068.Text & "', HARGAJUAL= " & Val(hj068.Text) & ", JUMLAHBARANG= " & Val(jb068.Text) & " WHERE KODEBARANG='" & kb1068.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
kb1068.Text = "-"
kb068.Text = ""
nb068.Text = ""
hj068.Text = ""
jb068.Text = ""
LATIHAN033A068.asni()
End Sub
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
If kb1068.Text = "-" Then
SIMPAN_INSERT()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Public Class Latihan33B
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb070.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb070.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj070.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb070.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> kb070.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CMT As New OleDb.OleDbCommand
CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb070.Text & "', '" & nb070.Text & "', " & Val(hj070.Text) & ", " & Val(jb070.Text) & ")", A)
A.Open()
CMT.ExecuteNonQuery()
A.Close()
CMT.Dispose()
KBrg1.Text = "-"
kb070.Text = ""
nb070.Text = ""
hj070.Text = ""
jb070.Text = ""
Latihan33A.by()
End Sub
Private Sub Simpan_UPDATE()
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb070.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb070.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(hj070.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(jb070.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> kb070.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb070.Text & "', NAMABARANG= '" & nb070.Text & "', HARGAJUAL= " & Val(hj070.Text) & ", JUMLAHBARANG= " & Val(jb070.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
A.Open()
CME.ExecuteNonQuery()
A.Close()
CME.Dispose()
KBrg1.Text = "-"
kb070.Text = ""
nb070.Text = ""
hj070.Text = ""
jb070.Text = ""
Latihan33A.by()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KBrg1.Text = "-" Then
SIMPAN_INSERT()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Public Class Form33B
BalasHapusDim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub insert()
If KB.Text.Length = 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
If c1.Text.Length = 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
If c2.Text.Length = 0 Then
MsgBox("nama barang sudah ada")
Exit Sub
End If
If Val(c3.Text) = 0 Then
MsgBox("harga barang sudah ada")
Exit Sub
End If
If Val(c4.Text) = 0 Then
MsgBox("jumlah barang sudah ada")
Exit Sub
End If
If KB.Text <> c1.Text Then
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I)
If cari.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
End If
Dim JKL As New OleDb.OleDbCommand
JKL = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', " & Val(c3.Text) & ", " & Val(c4.Text) & ")", I)
I.Open()
JKL.ExecuteNonQuery()
I.Close()
JKL.Dispose()
KB.Text = ""
c1.Text = ""
c2.Text = ""
c3.Text = ""
c4.Text = ""
Form33A.AB()
End Sub
Private Sub SIMPAN_UPDATE()
If KB.Text.Length = 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
If c1.Text.Length = 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
If c2.Text.Length = 0 Then
MsgBox("nama barang sudah ada")
Exit Sub
End If
If Val(c3.Text) = 0 Then
MsgBox("harga jual sudah ada")
Exit Sub
End If
If Val(c4.Text) = 0 Then
MsgBox("jumlah barang suda ada")
Exit Sub
End If
If KB.Text <> c1.Text Then
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I)
If cari.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
End If
Dim ASD As New OleDb.OleDbCommand
ASD = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & c1.Text & "', NAMABARANG= '" & c2.Text & "', HARGAJUAL= " & Val(c3.Text) & ", JUMLAHBARANG= " & Val(c4.Text) & " WHERE KODEBARANG='" & KB.Text & "'", I)
I.Open()
ASD.ExecuteNonQuery()
I.Close()
ASD.Dispose()
KB.Text = "-"
c1.Text = ""
c2.Text = ""
c3.Text = ""
c4.Text = ""
Form33A.AB()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If KB.Text = "-" Then
insert()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Muhammad Nur
BalasHapusPublic Class Latihan033A077
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub IA()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", n)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Latihan33A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
IA()
DGV33A.DataSource = datatabel1
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah.Click
If Latihan033B077.Visible = False Then
Latihan033B077.Show()
Else
Latihan033B077.Activate()
End If
Latihan033B077.Show()
Latihan033B077.KBrg1077.Text = "-"
Latihan033B077.KBrg077.Text = ""
Latihan033B077.NBrg077.Text = ""
Latihan033B077.HJual077.Text = ""
Latihan033B077.JBrg077.Text = ""
End Sub
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click
If Latihan033B077.Visible = False Then
Latihan033B077.Show()
Else
Latihan033B077.Activate()
End If
Latihan033B077.Show()
Latihan033B077.KBrg1077.Text = DGV33A.CurrentRow.Cells("Kodebarang").Value
Latihan033B077.KBrg077.Text = DGV33A.CurrentRow.Cells("Kodebarang").Value
Latihan033B077.NBrg077.Text = DGV33A.CurrentRow.Cells("Namabarang").Value
Latihan033B077.HJual077.Text = DGV33A.CurrentRow.Cells("Hargajual").Value
Latihan033B077.JBrg077.Text = DGV33A.CurrentRow.Cells("Jumlahbarang").Value
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DGV33A.CurrentRow.Cells("KODEBARANG").Value & "'", n)
n.Open()
CM.ExecuteNonQuery()
n.Close()
CM.Dispose()
IA()
End Sub
End Class
Public Class Latihan033B077
BalasHapusDim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_INSERT()
If KBrg1077.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KBrg077.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NBrg077.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(Hjual077.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JBrg077.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1077.Text <> KBrg077.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CMT As New OleDb.OleDbCommand
CMT = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KBrg077.Text & "', '" & NBrg077.Text & "', " & Val(Hjual077.Text) & ", " & Val(JBrg077.Text) & ")", n)
n.Open()
CMT.ExecuteNonQuery()
n.Close()
CMT.Dispose()
KBrg1077.Text = "-"
KBrg077.Text = ""
NBrg077.Text = ""
Hjual077.Text = ""
JBrg077.Text = ""
Latihan033A077.IA()
End Sub
Private Sub SIMPAN_UPDATE()
BalasHapusIf KBrg1077.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KBrg077.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NBrg077.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(Hjual077.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JBrg077.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1077.Text <> KBrg077.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CME As New OleDb.OleDbCommand
CME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KBrg077.Text & "', NAMABARANG= '" & NBrg077.Text & "', HARGAJUAL= " & Val(Hjual077.Text) & ", JUMLAHBARANG= " & Val(JBrg077.Text) & " WHERE KODEBARANG='" & KBrg1077.Text & "'", n)
n.Open()
CME.ExecuteNonQuery()
n.Close()
CME.Dispose()
KBrg1077.Text = "-"
KBrg077.Text = ""
NBrg077.Text = ""
Hjual077.Text = ""
JBrg077.Text = ""
Latihan033A077.IA()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KBrg1077.Text = "-" Then
SIMPAN_INSERT()
Else
SIMPAN_UPDATE()
End If
End Sub
End Class
Dim CME As New OleDb.OleDbCommand
BalasHapusCME = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & Kode_Barang_082.Text & "', NAMABARANG= '" & Nama_Barang_082.Text & "', HARGAJUAL= " & Val(Harga_jual_082.Text) & ", JUMLAHBARANG= " & Val(Jumlah_Barang_082.Text) & " WHERE KODEBARANG='" & KB_082.Text & "'", Adhe)
Adhe.Open()
CME.ExecuteNonQuery()
Adhe.Close()
CME.Dispose()
KB_082.Text = "-"
Kode_Barang_082.Text = ""
Nama_Barang_082.Text = ""
Harga_Jual_082.Text = ""
Jumlah_Barang_082.Text = ""
Form33.Rheza()
End Sub
Private Sub Save_082_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save_082.Click
If KB_082.Text = "-" Then
Save_082_INSERT()
Else
Save_082_UPDATE()
End If
End Sub
Private Sub Form33B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class latihan_33a
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=nideria")
Dim cari As New DataTable
Public Sub danang()
Dim adap As New OleDb.OleDbDataAdapter
adap = New OleDb.OleDbDataAdapter("select * from barang", conect)
cari.Rows.Clear()
adap.Fill(cari)
adap.Dispose()
End Sub
Private Sub latihan_33a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
danang()
dgv.DataSource = cari
End Sub
Private Sub Button2069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2069.Click
If latihan_33b.Visible = False Then
latihan_33b.Show()
Else
latihan_33b.Activate()
End If
End Sub
Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click
If latihan_33b.Visible = False Then
latihan_33b.Show()
Else
latihan_33b.Activate()
End If
latihan_33b.KB.Text = dgv.CurrentRow.Cells("KODEBARANG").Value
latihan_33b.kobar069.Text = dgv.CurrentRow.Cells("KODEBARANG").Value
latihan_33b.nabar069.Text = dgv.CurrentRow.Cells("NAMABARANG").Value
latihan_33b.harju069.Text = dgv.CurrentRow.Cells("HARGAJUAL").Value
latihan_33b.jubar069.Text = dgv.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
Private Sub Button3069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3069.Click
Dim prayudha As New OleDb.OleDbCommand
prayudha = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & dgv.CurrentRow.Cells("KODEBARANG").Value & "'", conect)
conect.Open()
prayudha.ExecuteNonQuery()
conect.Close()
prayudha.Dispose()
danang()
End Sub
End Class
Public Class latihan_33b
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=nideria")
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click
If kobar069.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If nabar069.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(harju069.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(jubar069.Text) = 0 Then
MsgBox("jumlah barang")
Exit Sub
End If
cari.AturPencarianDataBase("barang", "kodebarang", kobar069.Text, 1, conect)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into barang(kodebarang,namabarang,hargajual,jumlahbarang) Values('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", conect)
conect.Open()
com.ExecuteNonQuery()
conect.Close()
com.Dispose()
kobar069.Text = ""
nabar069.Text = ""
harju069.Text = ""
jubar069.Text = ""
latihan_33a.danang()
End Sub
End Class