尝试执行删除查询并收到以下错误
查询表达式“cname VALUES @cname”中有语法错误(缺少运算符)。
代码
Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Settings.strFileName)
conn.Open()
Dim cmdText = "DELETE FROM products WHERE cname VALUES @cname"
Dim cmd As OleDbCommand = New OleDbCommand(cmdText, conn)
With cmd.Parameters
.Add(New OleDbParameter("@cname", DataGridView1.Item("cname", i).Value))
End With
Dim dt As New DataTable("products")
cmd.ExecuteNonQuery()
conn.Close()
conn = Nothing