注册 登录
编程论坛 ASP技术论坛

再提select问题

jjld 发布于 2010-07-30 09:30, 396 次点击
rst.open "select * from neirong where fornatdatetime(n_date,2)='"&date()&"'",conn,1,1
<%=rst.recordcount%>仍无显示。
用下面代码能达到效果,但还是想学习一下,看有没有更好的简单方法。
   num=0
    rst.open "select n_date from neirong",conn,1,1
    while not rst.eof
    if cdate(formatdatetime(rst("n_date"),2))=date() then
    num=num+1
    end if
    rst.movenext
    wend
2 回复
#2
冰镇柠檬汁儿2010-07-30 10:53
<%=rst.recordcount%>显示不了嘛?你的代码是怎么写的呢?可以放上来吗?
另外还有个办法,
rst.open "select count(n_date) as ndate from neirong",conn,1,1
    while not rst.eof
        num = rst("ndate")
    rst.movenext
    wend
呵呵
#3
gupiao1752010-07-30 16:24
rst.open "select * from neirong where fornatdatetime(n_date,2)='"&date()&"'",conn,1,1
那个函数没给你报错??
rst.open "select count(n_date) as ndate from neirong where formatdatetime(n_date,2)='"&date()&"'",conn,1,1
如果是ACCESS改这样试试:
rst.open "select count(n_date) as ndate from neirong where formatdatetime(n_date,2)=#"&date()&"#",conn,1,1
以上内容未经测试,仅供参考!
1