asp 日期查询问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 22:27:36
rs=conn.execute("select count(*) as recordcount from ruzhang where cpxitongtime between #"&cptime1&"# and #"&cptime2&"#" ")

提示错误为 错误类型:
Microsoft VBScript 编译器错误 (0x800A0409)
未结束的字符串常量
没有人知道这个是为什么吗?答对再追加50分,谢谢各位帮忙了啊

rs=conn.execute("select count(*) as recordcount from ruzhang where cpxitongtime between #"&cptime1&"# and #"&cptime2&"#")

可以这样试试
rs=conn.execute("select count(*) as recordcount from ruzhang where DateDiff('d',cpxitongtime,'"&cptime1&"')<=0 and DateDiff('d',cpxitongtime,'"&cptime2&"')>=0 ")