Public Class Form32a_36109028
Dim dt As New DataTable
Dim veny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub cv()
Dim aa As New OleDb.OleDbDataAdapter
aa = New OleDb.OleDbDataAdapter("select * from barang", veny)
dt.Rows.Clear()
aa.Fill(dt)
aa.Dispose()
End Sub
Private Sub Form32a_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cv()
dgv.DataSource = dt
End Sub
Private Sub t_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t.Click
If Form32b_36109028.Visible = False Then
Form32b_36109028.Show()
Else
Form32b_36109028.Activate()
End If
End Sub
Private Sub ede_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ede.Click
If Form32c_36109028.Visible = False Then
Form32c_36109028.Show()
Else
Form32c_36109028.Activate()
End If
Form32c_36109028.aa.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form32c_36109028.bb.Text = dgv.CurrentRow.Cells("namabarang").Value
Form32c_36109028.cc.Text = dgv.CurrentRow.Cells("hargajual").Value
Form32c_36109028.dd.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form32c_36109028.ff.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form32c_36109028.Show()
End Sub
End Class
Public Class Form32b_36109028
Dim Tumim As New ByIskandar.CariKeDataBaseByIskandar
Dim veny As New OleDb.OleDbCommand
Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub Form32b_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If aa.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If bb.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(cc.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(dd.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
Tumim.AturPencarianDataBase("Barang", "KodeBarang", aa.Text, 1, vetom)
If Tumim.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
veny = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & aa.Text & "','" & bb.Text & "'," & Val(cc.Text) & "," & Val(dd.Text) & ")", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
aa.Text = ""
bb.Text = ""
cc.Text = ""
dd.Text = ""
Form32a_36109028.cv()
End Sub
End Class
Public Class Form32c_36109028
Dim Tumim As New ByIskandar.CariKeDataBaseByIskandar
Dim veny As New OleDb.OleDbCommand
Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ee.Click
If aa.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If bb.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(cc.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(dd.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If aa.Text <> ff.Text Then
Tumim.AturPencarianDataBase("Barang", "KodeBarang", aa.Text, 1, vetom)
If Tumim.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
veny = New OleDb.OleDbCommand("update barang set kodebarang = '" & aa.Text & "', namabarang = '" & bb.Text & "', hargajual = " & Val(cc.Text) & ", jumlahbarang = " & Val(dd.Text) & " where kodebarang = '" & ff.Text & "'", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
aa.Text = ""
bb.Text = ""
cc.Text = ""
dd.Text = ""
ff.Text = ""
Form32a_36109028.cv()
End Sub
End Class