有一个存储过程,求对应的asp

victorli 2002-02-25 03:07:58
declare @i int
declare @year int
declare @month int
declare @day int
declare @Count int
set @i=0
set @year=2001
set @month=12
set @day=20
while @i<23
begin
select @Count=count(*) from server where day(VisitTime)=@day and month(VisitTime)=@month and year(VisitTime)=@year and DATENAME(Hour,VisitTime)=@i
set @i=@i+1
end
要输出@Count的值
...全文
49 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jadesun 2002-02-25
  • 打赏
  • 举报
回复
要不你就直接写成select count(*) as number from server where day(VisitTime)=@day and month(VisitTime)=@month and year(VisitTime)=@year and DATENAME(Hour,VisitTime)=@i

然后ASP中用"EXEC sp_name @变量=值"传递过去执行

然后用rs读出来
jadesun 2002-02-25
  • 打赏
  • 举报
回复
@Count=count(*) 这样能行吗?
neweb 2002-02-25
  • 打赏
  • 举报
回复
TYear = 2001
TMonth = 12
TDay = 20
TDate = DateSerial(TYear,TMonth,TDay) '得到日期型变量
for i=0 to 23
strQ = "select count(*) from server where datediff(d,VisitTime,'" &TDate& "')=0 and DATENAME(Hour,VisitTime)="&I
set rs = conn.Execute(strQ)
response.write rs(0) & "<br>"
next
lanying 2002-02-25
  • 打赏
  • 举报
回复
没心思看,先up一下

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧