ASP统计问题,谁能帮看一下

来源:百度知道 编辑:UC知道 时间:2024/05/05 23:02:08
我想从INFO表中,统计文圣街道的本月稿件数量,writefrom是文章来源,adddate是文章录入时间.结果统计不出来,高手帮解.问题一定是出现在时间上,但我自己不会改.把 and adddate='"&month(date())&"'去掉,会显示出文圣街道文章总数,但我现在要按月统计,应该怎么办?代码如下:

<%
function count_biao7(biao)
set rskz=server.createobject("adodb.recordset")
set rskz=conn.execute("select count(*) from Info where writefrom ='文圣街道' and adddate='"&month(date())&"'" )
Response.Write rskz(0)
rskz.close
set rskz=nothing
end function
%>
<%= count_biao7("Info") %>
按楼下方法,出现
错误类型:
Microsoft VBScript 编译器错误 (0x800A03EE)
缺少 ')'
/Topdep1.asp, line 201, column 92
set rskz=conn.execute("select count(*) from "&biao&" where writefrom ='文圣街道' and month("adddate" )='"&month(date())&"'" )
--------------------------------------------------------------------------------

adddate字段改为month("adddate" )
否则一边是完整日期一边是月份 日期类型和数字类型不能比较吧
所以去不出结果来
年的话就改为
year("adddate" )

?
"select count(*) from "&biao&" where writefrom ='区委组织部' and month(""adddate"")="&month(date())