ما الخطاء فى هذا الكود مع العلم بان قاعده البيانات اكسس والجدول يتكون من number-name-unit-unitprice والمفتاح الاساسى (number)
Dim number, name, unit, unitprice As String
number = TextBox1.Text
name = TextBox2.Text
unit = TextBox3.Text
unitprice = TextBox4.Text
If number = "" Or name = "" Or unit = "" Or unitprice = "" Then
MsgBox(" اكمل ادخال البيانات من فضلك ")
Exit Sub
End If
cm.CommandText = "insert into names(number,name,unit,unitprice)values('" & number & "','" & name & "','" & unit & "','" & unitprice & "')"
cm.Connection = cnn
Try
cm.ExecuteNonQuery()
MsgBox(" تم اضافه الصنف بنجاح")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Button2.Enabled = True
Button3.Enabled = True
Catch ex As Exception
MsgBox(ex.Message)
End Try