当我尝试执行下面的代码时出现以下错误。我也添加了我传递的 SQL 字符串。我错过了什么?
错误:
查询表达式“TOURID = 25e5eed3-ea84-4c30-a660-2c880253da60”中的语法错误(缺少运算符)
我的查询,
DELETE * FROM TOURS WHERE TOURID = 25e5eed3-ea84-4c30-a660-2c880253da60;
我的代码,
Dim connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\_Development\Data\filename.accdb;Persist Security Info=False;"
Dim DBConnection As New System.Data.OleDb.OleDbConnection(connectionString)
Try
DBConnection .Open()
Dim cmd As New System.Data.OleDb.OleDbCommand(sql, DBConnection )
Dim sqlAdapterTOURS As New System.Data.OleDb.OleDbDataAdapter(cmd)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
DBConnection .Close()
End Try