Public Class Latihan30A 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 by() 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 Latihan30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load by() dgv070.DataSource = datatabel1 End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click If Latihan30B.Visible = False Then Latihan30B.Show() Else Latihan30B.Activate() End If
Latihan30B.Show() Latihan30B.kb1070.Text = dgv070.CurrentRow.Cells("Kodebarang").Value Latihan30B.kb2070.Text = dgv070.CurrentRow.Cells("Kodebarang").Value Latihan30B.nb070.Text = dgv070.CurrentRow.Cells("Namabarang").Value Latihan30B.hj070.Text = dgv070.CurrentRow.Cells("Hargajual").Value Latihan30B.jb070.Text = dgv070.CurrentRow.Cells("Jumlahbarang").Value End Sub End Class
Public Class Latihan30B Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If kb1070.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb2070.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 kb1070.Text <> kb2070.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb2070.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb2070.Text & "', NAMABARANG= '" & nb070.Text & "', HARGAJUAL= " & Val(hj070.Text) & ", JUMLAHBARANG= " & Val(jb070.Text) & " WHERE KODEBARANG= '" & kb1070.Text & "'", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Public Class LATIHAN030A084 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 LATIHAN030A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Deriel() dgv_084.DataSource = datatabel1 End Sub
Private Sub Edit_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_084.Click If LATIHAN030B084.Visible = False Then LATIHAN030B084.Show() Else LATIHAN030B084.Activate() End If
LATIHAN030B084.Show() LATIHAN030B084.kb_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value LATIHAN030B084.kb1_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value LATIHAN030B084.nb_084.Text = dgv_084.CurrentRow.Cells("Namabarang").Value LATIHAN030B084.hj_084.Text = dgv_084.CurrentRow.Cells("Hargajual").Value LATIHAN030B084.jb_084.Text = dgv_084.CurrentRow.Cells("Jumlahbarang").Value End Sub End Class
Public Class LATIHAN030B084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_084.Click If kb_084.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If kb1_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 kb_084.Text <> kb1_084.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", kb1_084.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb1_084.Text & "', NAMABARANG= '" & nb_084.Text & "', HARGAJUAL= " & Val(hj_084.Text) & ", JUMLAHBARANG= " & Val(jb_084.Text) & " WHERE KODEBARANG= '" & kb_084.Text & "'", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Public Class Form30A 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 Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load feby() DGV_064.DataSource = datatabel1 End Sub
Private Sub EDIT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT.Click If Form30B.Visible = False Then Form30B.Show() Else Form30B.Activate() End If
Form30B.Show() Form30B.KB1_064.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value Form30B.KB2_064.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value Form30B.NB_064.Text = DGV_064.CurrentRow.Cells("Namabarang").Value Form30B.HJ_064.Text = DGV_064.CurrentRow.Cells("Hargajual").Value Form30B.JB_064.Text = DGV_064.CurrentRow.Cells("Jumlahbarang").Value End Sub
End Class
Public Class Form30B Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KB1_064.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KB2_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 KB1_064.Text <> KB2_064.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KB2_064.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB2_064.Text & "', NAMABARANG= '" & NB_064.Text & "', HARGAJUAL= " & Val(HJ_064.Text) & ", JUMLAHBARANG= " & Val(JB_064.Text) & " WHERE KODEBARANG= '" & KB1_064.Text & "'", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Form 30A Public Class Latihan30A_071 Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB") Dim take As New DataTable Public Sub ambildata() 'mendeklarasikan adapter Dim data As New OleDb.OleDbDataAdapter
'mengatur data yang akan diangkut data = New OleDb.OleDbDataAdapter("SELECT* from barang", go)
'bersihkan data sebelum mengisi data lain take.Rows.Clear()
'memasukkan data yg telah diambil ke dalam data grid view data.Fill(take) data.Dispose()
End Sub
Private Sub Latihan30A_071_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() DGV_071.DataSource = take
End Sub
Private Sub Edit_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_071.Click 'menampilkan form 30b If Latihan30B_071.Visible = False Then Latihan30B_071.Show() Else Latihan30B_071.Activate() End If
'mengisi textbox yang ada pada 30b Latihan30B_071.kode_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value Latihan30B_071.kb_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value Latihan30B_071.nb_071.Text = DGV_071.CurrentRow.Cells("namabarang").Value Latihan30B_071.hj_071.Text = DGV_071.CurrentRow.Cells("hargajual").Value Latihan30B_071.jb_071.Text = DGV_071.CurrentRow.Cells("jumlahbarang").Value
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 nurlina() 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 Latihan30A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load nurlina() DGV30A.DataSource = datatabel1 End Sub
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click If Latihan030B077.Visible = False Then Latihan030B077.Show() Else Latihan030B077.Activate() End If
Latihan030B077.Show() Latihan030B077.KBrg1.Text = DGV30A.CurrentRow.Cells("Kodebarang").Value Latihan030B077.KBrg.Text = DGV30A.CurrentRow.Cells("Kodebarang").Value Latihan030B077.NBrg.Text = DGV30A.CurrentRow.Cells("Namabarang").Value Latihan030B077.HJual.Text = DGV30A.CurrentRow.Cells("Hargajual").Value Latihan030B077.JBrg.Text = DGV30A.CurrentRow.Cells("Jumlahbarang").Value End Sub End Class
Public Class Latihan030B077
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click If KBrg1.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If KBrg.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NBrg.Text.Length = 0 Then MsgBox("Nama barang sudah ada") Exit Sub End If
If Val(HJual.Text) = 0 Then MsgBox("Harga jual sudah ada") Exit Sub End If
If Val(JBrg.Text) = 0 Then MsgBox("Jumlah barang sudah ada") Exit Sub End If
If KBrg1.Text <> KBrg.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg.Text, 1, n) If pencari.JumlanBaris > 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KBrg.Text & "', NAMABARANG= '" & NBrg.Text & "', HARGAJUAL= " & Val(Hjual.Text) & ", JUMLAHBARANG= " & Val(JBrg.Text) & " WHERE KODEBARANG= '" & KBrg1.Text & "'", n) n.Open() CM.ExecuteNonQuery() n.Close() CM.Dispose()
Dim I 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 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 CI As New OleDb.OleDbCommand CI = 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() CI.ExecuteNonQuery() I.Close() CI.Dispose()
Public Class latihan_30a Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=dannagprayudha") Dim danang As New DataTable
Private Sub latihan_30a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim coba As New OleDb.OleDbDataAdapter coba = New OleDb.OleDbDataAdapter("select * from barang", CONECT) coba.Fill(danang) dgv.DataSource = danang
End Sub End Class
Public Class latihan_30b Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha") Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub latihan_30b_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Val(kobar2069.Text) = 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 belum diisi") Exit Sub End If
Public Class Latihan30A
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 by()
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 Latihan30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
by()
dgv070.DataSource = datatabel1
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Latihan30B.Visible = False Then
Latihan30B.Show()
Else
Latihan30B.Activate()
End If
Latihan30B.Show()
Latihan30B.kb1070.Text = dgv070.CurrentRow.Cells("Kodebarang").Value
Latihan30B.kb2070.Text = dgv070.CurrentRow.Cells("Kodebarang").Value
Latihan30B.nb070.Text = dgv070.CurrentRow.Cells("Namabarang").Value
Latihan30B.hj070.Text = dgv070.CurrentRow.Cells("Hargajual").Value
Latihan30B.jb070.Text = dgv070.CurrentRow.Cells("Jumlahbarang").Value
End Sub
End Class
Public Class Latihan30B
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If kb1070.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb2070.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 kb1070.Text <> kb2070.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb2070.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb2070.Text & "', NAMABARANG= '" & nb070.Text & "', HARGAJUAL= " & Val(hj070.Text) & ", JUMLAHBARANG= " & Val(jb070.Text) & " WHERE KODEBARANG= '" & kb1070.Text & "'", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
kb1070.Text = ""
kb2070.Text = ""
nb070.Text = ""
hj070.Text = ""
jb070.Text = ""
'Menjalankan prosedur ambil data'
Latihan30A.by()
End Sub
End Class
FITRAH ADITYA
BalasHapusPublic Class LATIHAN030A084
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 LATIHAN030A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Deriel()
dgv_084.DataSource = datatabel1
End Sub
Private Sub Edit_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_084.Click
If LATIHAN030B084.Visible = False Then
LATIHAN030B084.Show()
Else
LATIHAN030B084.Activate()
End If
LATIHAN030B084.Show()
LATIHAN030B084.kb_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
LATIHAN030B084.kb1_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
LATIHAN030B084.nb_084.Text = dgv_084.CurrentRow.Cells("Namabarang").Value
LATIHAN030B084.hj_084.Text = dgv_084.CurrentRow.Cells("Hargajual").Value
LATIHAN030B084.jb_084.Text = dgv_084.CurrentRow.Cells("Jumlahbarang").Value
End Sub
End Class
Public Class LATIHAN030B084
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_084.Click
If kb_084.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If kb1_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 kb_084.Text <> kb1_084.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", kb1_084.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb1_084.Text & "', NAMABARANG= '" & nb_084.Text & "', HARGAJUAL= " & Val(hj_084.Text) & ", JUMLAHBARANG= " & Val(jb_084.Text) & " WHERE KODEBARANG= '" & kb_084.Text & "'", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
kb_084.Text = ""
kb1_084.Text = ""
nb_084.Text = ""
hj_084.Text = ""
jb_084.Text = ""
'Menjalankan prosedur ambil data'
LATIHAN030A084.Deriel()
End Sub
End Class
Public Class Form30A
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 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 Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
feby()
DGV_064.DataSource = datatabel1
End Sub
Private Sub EDIT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT.Click
If Form30B.Visible = False Then
Form30B.Show()
Else
Form30B.Activate()
End If
Form30B.Show()
Form30B.KB1_064.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value
Form30B.KB2_064.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value
Form30B.NB_064.Text = DGV_064.CurrentRow.Cells("Namabarang").Value
Form30B.HJ_064.Text = DGV_064.CurrentRow.Cells("Hargajual").Value
Form30B.JB_064.Text = DGV_064.CurrentRow.Cells("Jumlahbarang").Value
End Sub
End Class
Public Class Form30B
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KB1_064.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KB2_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 KB1_064.Text <> KB2_064.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KB2_064.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB2_064.Text & "', NAMABARANG= '" & NB_064.Text & "', HARGAJUAL= " & Val(HJ_064.Text) & ", JUMLAHBARANG= " & Val(JB_064.Text) & " WHERE KODEBARANG= '" & KB1_064.Text & "'", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
KB1_064.Text = ""
KB2_064.Text = ""
NB_064.Text = ""
HJ_064.Text = ""
JB_064.Text = ""
'Menjalankan prosedur ambil data'
Form30A.feby()
End Sub
End Class
Form 30A
BalasHapusPublic Class Latihan30A_071
Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
Dim take As New DataTable
Public Sub ambildata()
'mendeklarasikan adapter
Dim data As New OleDb.OleDbDataAdapter
'mengatur data yang akan diangkut
data = New OleDb.OleDbDataAdapter("SELECT* from barang", go)
'bersihkan data sebelum mengisi data lain
take.Rows.Clear()
'memasukkan data yg telah diambil ke dalam data grid view
data.Fill(take)
data.Dispose()
End Sub
Private Sub Latihan30A_071_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
DGV_071.DataSource = take
End Sub
Private Sub Edit_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_071.Click
'menampilkan form 30b
If Latihan30B_071.Visible = False Then
Latihan30B_071.Show()
Else
Latihan30B_071.Activate()
End If
'mengisi textbox yang ada pada 30b
Latihan30B_071.kode_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value
Latihan30B_071.kb_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value
Latihan30B_071.nb_071.Text = DGV_071.CurrentRow.Cells("namabarang").Value
Latihan30B_071.hj_071.Text = DGV_071.CurrentRow.Cells("hargajual").Value
Latihan30B_071.jb_071.Text = DGV_071.CurrentRow.Cells("jumlahbarang").Value
End Sub
End Class
Muhammad Nur
BalasHapusPublic Class Latihan030A077
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 nurlina()
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 Latihan30A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
nurlina()
DGV30A.DataSource = datatabel1
End Sub
Private Sub Edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit.Click
If Latihan030B077.Visible = False Then
Latihan030B077.Show()
Else
Latihan030B077.Activate()
End If
Latihan030B077.Show()
Latihan030B077.KBrg1.Text = DGV30A.CurrentRow.Cells("Kodebarang").Value
Latihan030B077.KBrg.Text = DGV30A.CurrentRow.Cells("Kodebarang").Value
Latihan030B077.NBrg.Text = DGV30A.CurrentRow.Cells("Namabarang").Value
Latihan030B077.HJual.Text = DGV30A.CurrentRow.Cells("Hargajual").Value
Latihan030B077.JBrg.Text = DGV30A.CurrentRow.Cells("Jumlahbarang").Value
End Sub
End Class
Public Class Latihan030B077
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
If KBrg1.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If KBrg.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NBrg.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
Exit Sub
End If
If Val(HJual.Text) = 0 Then
MsgBox("Harga jual sudah ada")
Exit Sub
End If
If Val(JBrg.Text) = 0 Then
MsgBox("Jumlah barang sudah ada")
Exit Sub
End If
If KBrg1.Text <> KBrg.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg.Text, 1, n)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KBrg.Text & "', NAMABARANG= '" & NBrg.Text & "', HARGAJUAL= " & Val(Hjual.Text) & ", JUMLAHBARANG= " & Val(JBrg.Text) & " WHERE KODEBARANG= '" & KBrg1.Text & "'", n)
n.Open()
CM.ExecuteNonQuery()
n.Close()
CM.Dispose()
KBrg1.Text = ""
KBrg.Text = ""
NBrg.Text = ""
HJual.Text = ""
JBrg.Text = ""
'Menjalankan prosedur ambil data'
Latihan030A077.nurlina()
End Sub
End Class
Public Class Form30B
BalasHapusDim I 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 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 CI As New OleDb.OleDbCommand
CI = 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()
CI.ExecuteNonQuery()
I.Close()
CI.Dispose()
kb.Text = ""
c1.Text = ""
c2.Text = ""
c3.Text = ""
c4.Text = ""
Form30A.chaty()
End Sub
End Class
Public Class latihan_30a
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=dannagprayudha")
Dim danang As New DataTable
Private Sub latihan_30a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim coba As New OleDb.OleDbDataAdapter
coba = New OleDb.OleDbDataAdapter("select * from barang", CONECT)
coba.Fill(danang)
dgv.DataSource = danang
End Sub
End Class
Public Class latihan_30b
Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub latihan_30b_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Val(kobar2069.Text) = 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 belum diisi")
Exit Sub
End If
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kobar069.Text, 1, CONECT)
If cari.JumlanBaris = False Then
MsgBox("kode tidak ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & kobar2069.Text & "', namabarang = '" & nabar069.Text & "', hargajual = " & Val(harju069.Text) & ", jumlahbarang = " & Val(jubar069.Text) & " where kodebarang ='" & kobar069.Text & "'", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
kobar069.Text = ""
kobar2069.Text = ""
nabar069.Text = ""
harju069.Text = ""
jubar069.Text = ""
End Sub
End Class