When I run the code below I keep getting the error message: Syntax error (missing operator) in query expression. What am I doing wrong?
con = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Database1.accdb"
connOledb.ConnectionString = con
connOledb.Open()
command = New OleDb.OleDbCommand("INSERT INTO Artikels VALUES('1'," + txtOmsch.Text + _
"','" + txtCat.Text + "','" + txtAPE.Text + _
"','" + txtMarge.Text + "','" + txtVPE.Text + _
"','" + txtEen.Text + "','" + txtLen.Text + _
"','" + txtBreed.Text + "','" + txtDiep.Text + _
txtOmsch.Text + "');")
command.Connection = connOledb
command.ExecuteNonQuery()
you have missed a single quote for the second value. try this,
your code is vulnerable with sql injection, please use parameterized query since you are using
ADO.NET, better try this code below,or
Add