Public Class Form29_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 s3_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s3_36109028.Click
If kb2_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb1_36109028.Text <> kb2_36109028.Text Then
Tumim.AturPencarianDataBase("Barang", "KodeBarang", kb2_36109028.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 = '" & kb2_36109028.Text & "', namabarang = '" & nb_36109028.Text & "', hargajual = " & Val(hj_36109028.Text) & ", jumlahbarang = " & Val(jb_36109028.Text) & " where kodebarang = '" & kb1_36109028.Text & "'", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
kb1_36109028.Text = ""
kb2_36109028.Text = ""
nb_36109028.Text = ""
hj_36109028.Text = ""
jb_36109028.Text = ""
End Sub
End Class
Public Class Form30a_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 vetom As New OleDb.OleDbDataAdapter
vetom = New OleDb.OleDbDataAdapter("select * from barang", veny)
dt.Rows.Clear()
vetom.Fill(dt)
vetom.Dispose()
End Sub
Private Sub Form30a_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cv()
dgv_36109028.DataSource = dt
End Sub
Private Sub e_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles e_36109028.Click
If Form30b_36109028.Visible = False Then
Form30b_36109028.Show()
Else
Form30b_36109028.Activate()
End If
Form30b_36109028.kb1_36109028.Text = dgv_36109028.CurrentRow.Cells("kodebarang").Value
Form30b_36109028.kb2_36109028.Text = dgv_36109028.CurrentRow.Cells("kodebarang").Value
Form30b_36109028.nb_36109028.Text = dgv_36109028.CurrentRow.Cells("namabarang").Value
Form30b_36109028.hj_36109028.Text = dgv_36109028.CurrentRow.Cells("hargajual").Value
Form30b_36109028.jb_36109028.Text = dgv_36109028.CurrentRow.Cells("jumlahbarang").Value
Form30b_36109028.Show()
End Sub
End Class
Public Class Form30b_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 s5_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s5_36109028.Click
If kb2_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb1_36109028.Text <> kb2_36109028.Text Then
Tumim.AturPencarianDataBase("Barang", "KodeBarang", kb2_36109028.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 = '" & kb2_36109028.Text & "', namabarang = '" & nb_36109028.Text & "', hargajual = " & Val(hj_36109028.Text) & ", jumlahbarang = " & Val(jb_36109028.Text) & " where kodebarang = '" & kb1_36109028.Text & "'", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
kb1_36109028.Text = ""
kb2_36109028.Text = ""
nb_36109028.Text = ""
hj_36109028.Text = ""
jb_36109028.Text = ""
Form30a_36109028.cv()
End Sub
End Class
Tidak ada komentar:
Posting Komentar