此错误出现在vb代码的以下行中
rs.Open "select * From Reservation where [table_number]=tablenumber.text and booking_date=bookingdate.Text", cn, adOpenStatic, adLockPessimistic
Run Code Online (Sandbox Code Playgroud)
这是您的SQL查询的问题.消息的原因是SQL解析器无法在SQL查询中标识令牌并将其解释为您需要提供值的参数.
因此,您要么输错了部分字段或表名,要么以错误的方式创建SQL.我想后者应该阅读
rs.Open "select * From Reservation where [table_number] = " & tablenumber.text & " and booking_date=" & bookingdate.Text, cn, adOpenStatic, adLockPessimistic
Run Code Online (Sandbox Code Playgroud)
因为tablenumber和bookingdate很可能的窗体控件.
上面的查询不会开箱即用,因为您需要使用SQL查询的正确数据类型,我无法根据您的稀疏信息推断出这些数据类型.