帮忙改下这段ASP代码?

来源:百度知道 编辑:UC知道 时间:2024/05/28 16:19:49
我想统计当天信息数量,可我用下面的代码时,统计出来的为0,可明明数据库里有当天的数据
<%
Set rscount0 = conn.Execute("select count(*) as cot0 from product where [adddate]=date()")
%>
谢谢
我用的是access数据库,adddate为datetime型

<%
access数据库用:
Set rscount0 = conn.Execute("select count(*) as cot0 from product where datediff('day',[adddate],'"&now()&"')=0")

sql数据库用:
Set rscount0 = conn.Execute("select count(*) as cot0 from product where datediff(day,[adddate],getdate())=0")
%>
--------------------------------------------
你用的是什么数据库?
adddate是什么类型?
有什么出错提示,还是结果还是0?
试试
Set rscount0 = conn.Execute("select count(*) as cot0 from product where datediff('d',[adddate],Now())=0")