Public Class Form30B_36109020
Dim cmnd As New OleDb.OleDbCommand
Dim dhedhe As New ByIskandar.CariKeDataBaseByIskandar
Dim ksr As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_36109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109020.Click
If t1_36109020.Text.Length = 0 Then
MsgBox("fill the blank please")
Exit Sub
End If
If t2_36109020.Text.Length = 0 Then
MsgBox("fill the blank please")
Exit Sub
End If
If Val(t3_36109020.Text) = 0 Then
MsgBox("fill the blank please")
Exit Sub
End If
If Val(t4_36109020.Text) = 0 Then
MsgBox("fill the blank please")
Exit Sub
End If
If kb_36109020.Text <> t1_36109020.Text Then
dhedhe.AturPencarianDataBase("Barang", "KodeBarang", t1_36109020.Text, 1, ksr)
If dhedhe.JumlanBaris > 0 Then
MsgBox("Kode sudah ada")
Exit Sub
End If
End If
cmnd = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109020.Text & "', namabarang = '" & t2_36109020.Text & "', hargajual = " & Val(t3_36109020.Text) & ", jumlahbarang = " & Val(t4_36109020.Text) & " where kodebarang = '" & kb_36109020.Text & "'", ksr)
ksr.Open()
cmnd.ExecuteNonQuery()
ksr.Close()
cmnd.Dispose()
kb_36109020.Text = ""
t1_36109020.Text = ""
t2_36109020.Text = ""
t3_36109020.Text = ""
t4_36109020.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar