Public Class Form28B_36109020
Dim dhedhe As New ByIskandar.CariKeDataBaseByIskandar
Dim cmnd As New OleDb.OleDbCommand
Dim ksr As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE ='" & Application.StartupPath & "\Databarang.ACCDB'")
Private Sub save_36109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_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
dhedhe.AturPencarianDataBase("Barang", "KodeBarang", t1_36109020.Text, 1, ksr)
If dhedhe.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
cmnd = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109020.Text & "','" & t2_36109020.Text & "'," & Val(t3_36109020.Text) & "," & Val(t4_36109020.Text) & ")", ksr)
ksr.Open()
cmnd.ExecuteNonQuery()
ksr.Close()
cmnd.Dispose()
t1_36109020.Text = ""
t2_36109020.Text = ""
t3_36109020.Text = ""
t4_36109020.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar