asp 统计一个栏目当天更新的条数?
<%dimztcountsetrs=server.createobject("adodb.recordset")sql="selectcount(*)ztcountfro...
<%
dim ztcount
set rs=server.createobject("adodb.recordset")
sql = "select count(*) ztcount from Article where ClassID=1 and datediff('d',UpdateTime,"&date()&")=0"
rs.open sql,conn,1,3
if not rs.eof then
ztcount=rs("ztcount")
else
ztcount=0
end if
response.write("今日留言:"&ztcount)
%>
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'count(*) ztcount' 中。
/Index_Top.asp, 第 45 行
UpdateTime 时间格式是这样的 2013-10-29 15:28:08 展开
dim ztcount
set rs=server.createobject("adodb.recordset")
sql = "select count(*) ztcount from Article where ClassID=1 and datediff('d',UpdateTime,"&date()&")=0"
rs.open sql,conn,1,3
if not rs.eof then
ztcount=rs("ztcount")
else
ztcount=0
end if
response.write("今日留言:"&ztcount)
%>
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'count(*) ztcount' 中。
/Index_Top.asp, 第 45 行
UpdateTime 时间格式是这样的 2013-10-29 15:28:08 展开
2个回答
展开全部
sql = "select count(*) as ztcount from Article where ClassID=1 and datediff('d',UpdateTime,now())=0"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and datediff('d',UpdateTime,#" & date() & "#)=0"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and format(UpdateTime,'yyyymmdd')=format(now(),'yyyymmdd')"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and format(UpdateTime,'yyyymmdd')=format(#" & date() & "#,'yyyymmdd')"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and datediff('d',UpdateTime,#" & date() & "#)=0"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and format(UpdateTime,'yyyymmdd')=format(now(),'yyyymmdd')"
或者
sql = "select count(*) as ztcount from Article where ClassID=1 and format(UpdateTime,'yyyymmdd')=format(#" & date() & "#,'yyyymmdd')"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询