Public Class Form31A_36109006
Dim rr As New DataTable
Dim harun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub muhharun()
Dim hrun As New OleDb.OleDbDataAdapter
hrun = New OleDb.OleDbDataAdapter("select * from barang", harun36109006)
rr.Rows.Clear()
hrun.Fill(rr)
hrun.Dispose()
End Sub
Private Sub Form_31A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
muhharun()
dgv_36109006.DataSource = rr
End Sub
Private Sub edit_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109006.Click
If Form31B_36109006.Visible = False Then
Form31B_36109006.Show()
Else
Form31B_36109006.Activate()
End If
Form31B_36109006.kb_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
Form31B_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
Form31B_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
Form31B_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
Form31B_36109006.kbl_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
Form31B_36109006.Show()
End Sub
End Class
Public Class Form31B_36109006
Dim muhharun36109006 As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim hrun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
If kb_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
If kb_36109006.Text <> kbl_36109006.Text Then
muhharun36109006.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, hrun36109006)
If muhharun36109006.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & kbl_36109006.Text & "'", hrun36109006)
hrun36109006.Open()
cm.ExecuteNonQuery()
hrun36109006.Close()
cm.Dispose()
kb_36109006.Text = ""
nb_36109006.Text = ""
hj_36109006.Text = ""
jb_36109006.Text = ""
kbl_36109006.Text = "-"
Form31A_36109006.muhharun()
End Sub
End Class
Dim rr As New DataTable
Dim harun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub muhharun()
Dim hrun As New OleDb.OleDbDataAdapter
hrun = New OleDb.OleDbDataAdapter("select * from barang", harun36109006)
rr.Rows.Clear()
hrun.Fill(rr)
hrun.Dispose()
End Sub
Private Sub Form_31A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
muhharun()
dgv_36109006.DataSource = rr
End Sub
Private Sub edit_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109006.Click
If Form31B_36109006.Visible = False Then
Form31B_36109006.Show()
Else
Form31B_36109006.Activate()
End If
Form31B_36109006.kb_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
Form31B_36109006.nb_36109006.Text = dgv_36109006.CurrentRow.Cells("namabarang").Value
Form31B_36109006.hj_36109006.Text = dgv_36109006.CurrentRow.Cells("hargajual").Value
Form31B_36109006.jb_36109006.Text = dgv_36109006.CurrentRow.Cells("jumlahbarang").Value
Form31B_36109006.kbl_36109006.Text = dgv_36109006.CurrentRow.Cells("kodebarang").Value
Form31B_36109006.Show()
End Sub
End Class
Public Class Form31B_36109006
Dim muhharun36109006 As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim hrun36109006 As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109006.Click
If kb_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
If kb_36109006.Text <> kbl_36109006.Text Then
muhharun36109006.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, hrun36109006)
If muhharun36109006.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb_36109006.Text & "', namabarang = '" & nb_36109006.Text & "', hargajual = " & Val(hj_36109006.Text) & ", jumlahbarang = " & Val(jb_36109006.Text) & " where kodebarang = '" & kbl_36109006.Text & "'", hrun36109006)
hrun36109006.Open()
cm.ExecuteNonQuery()
hrun36109006.Close()
cm.Dispose()
kb_36109006.Text = ""
nb_36109006.Text = ""
hj_36109006.Text = ""
jb_36109006.Text = ""
kbl_36109006.Text = "-"
Form31A_36109006.muhharun()
End Sub
End Class


0 komentar:
Posting Komentar