Jumat, 18 November 2011

Latihan 29


Public Class Latihan29_46109060
Dim fadli As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OleDb:database password=060")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109060.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If tb146109060.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If tb246109060.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(tb346109060.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(tb446109060.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", tb146109060.Text, 1, fadli)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
kb46109060.Text = ""
tb246109060.Text = ""
tb346109060.Text = ""
tb446109060.Text = ""
Exit Sub
End If
Dim Fadli As New OleDb.OleDbCommand
Fadli = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & tb146109060.Text & "' , NAMABARANG = '" & tb246109060.Text & "' , HARGAJUAL=" & Val(tb346109060.Text) & ", JUMLAHBARANG =" & Val(tb446109060.Text) & " where KODEBARANG ='" & kb46109060.Text & "'", fadli)
fadli.Open()
Fadli.ExecuteNonQuery()
fadli.Close()
Fadli.Dispose()
kb46109060.Text = ""
tb146109060.Text = ""
tb246109060.Text = ""
tb346109060.Text = ""
tb446109060.Text = ""
End Sub
End Class

Tidak ada komentar:

Posting Komentar