调用存储过程如何获取返回值?

javanj 2007-01-16 10:01:16
这个存储过程是我用一段程序改的,在查询分析器里执行是有正常返回结果的,但是我在ASP里面用SET RECORDSET=CONN.EXECUTE执行的时候就会陷入循环里面。请帮忙指点以下。

CREATE PROCEDURE psp_WorkSumary
@sStartDate nvarchar(50),
@sEndDate nvarchar(50),
@iPersonID int

AS
SET NOCOUNT ON
DECLARE @tmp1 TABLE (iJobName int,sJobName nvarchar(50),fJobSum float)

INSERT INTO @tmp1 (iJobName,sJobName,fJobSum)
(
SELECT
tbl_Workload.iJobName,tbl_jBase.sJobName,SUM(tbl_Workload.fJobCount) as fJobSum
FROM
tbl_Workload,tbl_jBase
WHERE
tbl_Workload.iJobName=tbl_jBase.AID
and tbl_Workload.iPersonid=@iPersonID
and (dCMPDate BETWEEN @sStartDate AND @sEndDate)
GROUP BY
tbl_Workload.iJobName,tbl_jBase.sJobName
)

DECLARE @tmp2 TABLE (iJobName int,sJobName nvarchar(50),fJobSum float)

INSERT INTO @tmp2 (iJobName,sJobName,fJobSum)
(
SELECT
tbl_Workload.iJobName,tbl_jBase.sJobName,SUM(tbl_Workload.fJobCount) as fJobSum
FROM
tbl_Workload,tbl_jBase
WHERE
tbl_Workload.iJobName=tbl_jBase.AID
and tbl_Workload.iAuditStatus=2
and tbl_Workload.iPersonid=@iPersonID
and (dCMPDate BETWEEN @sStartDate AND @sEndDate)
GROUP BY
tbl_Workload.iJobName,tbl_jBase.sJobName
)

SELECT
t1.*,isnull(t2.fJobSum,0) as fJobSumAudit
FROM
@tmp1 as t1,@tmp2 as t2
WHERE
t1.iJobName*=t2.iJobName

SET NOCOUNT OFF
GO
...全文
122 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2007-01-16 10:01
社区公告
暂无公告