Public Class tugas2746109033
Dim konek As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New OleDb.OleDbCommand
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("Kode Barang Belum Terisi Pak")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("Nama Barang Belum Terisi Pak")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("Harga Jual Belum Kita Isi Pak")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("Jumlah Barang Belum Kita Isi Pak")
Exit Sub
End If
itik = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & ")", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar