Public Class tugas2946109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If kb46109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
kb46109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
Dim taufiq As New OleDb.OleDbCommand
taufiq = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "' , NAMABARANG = '" & t246109033.Text & "' , HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG =" & Val(t446109033.Text) & " where KODEBARANG ='" & kb46109033.Text & "'", konek)
konek.Open()
taufiq.ExecuteNonQuery()
konek.Close()
taufiq.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar