Dim MyInsert As String = "INSERT INTO Inventory(userid,
Type,Number) Values(" & _
txtEquipCat.text & "," & _
Type.Text & "," & _
Number.text & ")"
while executing this im getting
syntax error:Insert in to statement
error.
How to insert keywords like type and number in to MDB? I want to specify the columnname while insert.
First of all, use parameters. Secondly, your string concoction isn't putting "quotes" around the text.
That is, VALUES ('" & txtEquipCat.Text & "',...
Don't try to fix it like that though.
Use parameters: VALUES (?, ?, ?)
cmd.Parameters.AddWithValue("?", txtEquipCat.Text)
Notice with parameters, you do not have to worry about any quotation marks. The parameters have to be entered in order, so the first "?" corresponds to txtEquipCat, the second to Type.Text, etc.