10元茶叶批发价格表:select语句第一次执行正确,第二次出错

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 06:42:11
"select * from ypls where xssj = " & CDate(txtRQ.Text) & " order by lsbh"

在程序中第一次查询时(数据库中没有数据)能正确执行,第二次查询时(数据库中有数据)出现以下错误:
"查询错误: 语法错误 (操作符丢失) 在查询表达式 'xssj = 2006-2-22 19:09:56' 中。"

"select * from ypls where xssj = #"&txtRQ.Text&"# order by lsbh"

试试这样!

加个括号:
"select * from ypls where xssj = [" & CDate(txtRQ.Text) & "] order by lsbh"