回 帖 发 新 帖 刷新版面

主题:存储过程问题

存储过程 
create  procedure mainboard_graphTypeno 
@second int output,
@yyear int,
@mmonth int
as
 begin
 select @second=count(*) from (select *from mainboard where year(fix_date)=@yyear and month(fix_date)=@mmonth) a 
inner join (select typename from mainboard where year(fix_date)<=@yyear and month(fix_date)<=@mmonth
 group by typename having count(typename)>=2) b on a.typename=b.typename

select typeno,dd=(select count(1) from mainboard where typeno=a.typeno and year(fix_date)=@yyear and month(fix_date)=@mmonth and type='主板') from mainboard a  where year(fix_date)=@yyear and month(fix_date)=@mmonth and type='主板' group by typeno
order by dd desc
我想在下面反回记录值和记录集,cpu总是100%,那里错了?

set cmd=server.CreateObject("adodb.command")
cmd.ActiveConnection=conn
cmd.CommandText="dbo.mainboard_graphTypeno"
cmd.CommandType=4
cmd.Prepared=true
cmd.Parameters.Append cmd.CreateParameter("@second",2,3)
cmd.Parameters.append cmd.CreateParameter("@yyear",3,1,4,yyear)
cmd.Parameters.append cmd.CreateParameter("@mmonth",3,1,4,mmonth)
'set rs=server.CreateObject("adodb.recordset")
'rs.Open cmd,,1,1
set rs=cmd.execute
rowcount=cmd.Parameters("@second").value
do while not rs.eof
 ....
 rs.MoveNext
  loop

回复列表 (共3个回复)

沙发

看不清楚

板凳

你的查询语句有问题吧,second既然是做为输出的,怎么又用来做查询条件了呢?

3 楼

先看看表是怎么样的

我来回复

您尚未登录,请登录后再回复。点此登录或注册