蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 http://www.lslnet.com 2006年8月25日 8:28

[asp] 请教实现按日期查询的问题

自己写的代码段如下:从name4 的文本框中接受日期输入yyyy-mm-dd的形式

<% opDate=trim(Request("name4"))%>
<%  Set ConnObj = Server.CreateObject("ADODB.Connection")
    DbPath=Server.MapPath("DB.mdb")
    ConnObj.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="& DbPath
        Set RSobj=Server.Createobject("ADODB.Recordset")
    SQL="select* from report where userId='"&session("userId")&"'"
        SQL=SQL & "where opDate="&"#"&opDate&"#"&""           
        Set RSobj = ConnObj.Execute(SQL)             <..............出错之处



错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失) 在查询表达式 'userId='1001'where opDate=#2005-8-10#' 中。
/updateSubmit.asp, 第 15 行





SQL="select* from report where userId='"&session("userId")&"'"
    SQL=SQL & "[color=red]and[/color] opDate="&"#"&opDate&"#"&""

nanchen99cn在上个帖子中说


搞定,太谢谢你了。




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com