Public Class LATIHAN027_46109040
Dim jembatan As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=46109040")
Private Sub Simpan_46109040_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109040.Click
If Val(KB_46109040.Text) = 0 Then
MsgBox("Maaf Kode Barang Belum Diisi")
Exit Sub
End If
If NB_46109040.Text.Length = 0 Then
MsgBox("Maaf Nama Barang Belum Diisi")
Exit Sub
End If
If Val(HJ_46109040.Text) = 0 Then
MsgBox("Maaf Harga Jual Belum Diisi")
Exit Sub
End If
If Val(JB_46109040.Text) = 0 Then
MsgBox("Maaf Jumlah Barang Belum Diisi")
Exit Sub
End If
Dim ukky As New OleDb.OleDbCommand
ukky = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KB_46109040.Text & "','" & NB_46109040.Text & "'," & Val(HJ_46109040.Text) & "," & Val(JB_46109040.Text) & ")", jembatan)
jembatan.Open()
ukky.ExecuteNonQuery()
jembatan.Close()
ukky.Dispose()
KB_46109040.Text = " "
NB_46109040.Text = " "
HJ_46109040.Text = " "
JB_46109040.Text = " "
End Sub
End Class
Tidak ada komentar:
Posting Komentar