用asp调用存储过程的问题,弄了两天了

antitrust 2004-02-13 09:12:38
单位写的过程很奇怪,有时候可以调用,有时候报错对象关闭,无法操作
调用方法:
1,rs.Open "Exec new_1 '12345'",conn2,1,3
2,set rs=Server.CreateObject("ADODB.Recordset")
set cmd=Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection=conn2
with cmd
.CommandText ="px_zcfzb"
.CommandType = 4
.parameters.Refresh
.parameters("@nd")=2002
.parameters("@code")=600839
end with
set rs=cmd.Execute()
3,SQLString="new_1 '12345'"
set rs=connect.Execute(SQLString)

一操作rs.eof 或者rs.movenext就出错

附上某个过程,个人感觉好像和过程没有什么关系,因为在库里过程是能够执行的
declare @sql varchar(3000),@rq1 varchar(10),@rq2 varchar(10),@rq3 varchar(10),@rq4 varchar(10)
if month(getdate()) between '01' and '03'
begin
if (select max(len(q4)) from zcfzb where code=@code and nd=year(getdate())-1 and y=1) is null
begin
select @rq1=convert(char(4),year(getdate())-2)+'-12-31',@rq2=convert(char(4),year(getdate())-1)+'-03-31',@rq3=convert(char(4),year(getdate())-1)+'-06-30',@rq4=convert(char(4),year(getdate())-1)+'-09-30'
SET @SQL='select (select top 1 mc from bmqk where bmlb=''zcfz'' and bm=xm) as mc,(select a.q4 from zcfzb a where a.nd=year(getdate())-2 and a.y=1 and a.code='+@code+' and a.xm=zcfzb.xm) as '''+@rq1+''',q1 as '''+@rq2+''',q2 as '''+@rq3+''',q3'''+@rq4+''' from zcfzb where nd=year(getdate())-1 and y=1 and code= '+@code+''
end
else
begin
select @rq1=convert(char(4),year(getdate())-1)+'-03-31',@rq2=convert(char(4),year(getdate())-1)+'-06-30',@rq3=convert(char(4),year(getdate())-1)+'-09-30',@rq4=convert(char(4),year(getdate())-1)+'-12-31'
SET @SQL='select (select top 1 mc from bmqk where bmlb=''zcfz'' and bm=xm) as mc,q1 as '''+@rq1+''',q2 as '''+@rq2+''',q3 as '''+@rq3+''',q4 as '''+@rq4+''' from zcfzb where nd=year(getdate())-1 and y=1 and code= '+@code+''
end
exec (@sql)
end
GO
...全文
90 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
postfix2 2004-04-04
  • 打赏
  • 举报
回复
往数据库里写和更新的时间我一般都是用的存储过程,读的时间一般没有用过,不过.net下边我都用存储过程,方便,比在页面中处理起来更容易理解!
sunshinezss 2004-04-04
  • 打赏
  • 举报
回复
学习

28,407

社区成员

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

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