存储过程自动退出(200分)

  • 主题发起人 wwding68
  • 开始时间
W

wwding68

Unregistered / Unconfirmed
GUEST, unregistred user!
在delphi 中 我通过query 控件调用存储过程出现问题, 我在存储过程中用游标,
如果游标返回的数据集的条目比较多时,存储过程会自动的中断退出,游标返回的
纪录比较少的情况时,一切正常。在sql server query Analyzer中执行该存储过程
结果正常,没有以上的问题出现
 
你的存储过程是怎样的!
 
我的存储过程是定义了一个游标,从游标返回的数据集中一条一条地根据条件处理
无他
 
是不是存储过程运行超时了
 
to yanghai0437
存储过程的时间应该在那里设置
 
把代码贴出来瞧瞧。
 
我在定义游标时 加了 datepart(day,job_date)>15 条件也是由于同一个原因

declare cur_gaojian cursor forward_only for select id,ticai_id,job_date,job_count,totalfen, totalyuan,class,realfirst,
realsecond,words from gaojian where people_id=@people_id and datepart(year,job_date)=@year
and datepart(month,job_date)=@month and datepart(day,job_date)>15 and ticai_id<>100 and substring(ban_no,1,1)<>'S'

open cur_gaojian
fetch next from cur_gaojian into @id,@ticai_id,@job_date,@job_count,@totalfen,@totalyuan,@class,@realfirst,@realsecond,@words
while (@@fetch_status=0)
begin
-- 当一篇顶几篇,同时其中有一篇为甲等
select @bing1=0
if @job_count>1 and @class='甲' and (@ticai_id in (4,5,6,8))
begin
select @jia=jia from pay where ticai=@ticai_id
select @yi=yi from pay where ticai=@ticai_id
update gaojian set realfirst=1,realsecond=@job_count-1,totalfen=300+@yi*(@job_count) where id=@id
end
else
--如果是采访中心,甲乙丙为分,计算totalfen,否则为元 则计算totalyuan @bing
begin
if @class='甲' select @bing=jia,@bing1=yi from pay where ticai=@ticai_id
if @class='乙' select @bing=yi from pay where ticai=@ticai_id
if @class='丙' select @bing=bing from pay where ticai=@ticai_id
if @class='其它' select @bing=other from pay where ticai=@ticai_id

if (@GangWei in ('记者','通联记者','首席记者','英记者主任','主笔','评论员')) and (@ticai_id<100)
begin
if @bing1>0
update gaojian set totalfen=(@job_count*@bing1)+@bing*300*@job_count where id=@id
else
update gaojian set totalfen=(@job_count*@bing) where id=@id
select @bing1=0
end
else

begin
---英文报的稿酬*1.2

if (@dept_id in (210,211,212)) and (@ticai_id IN (103,106,110,160))
--select @bing=@bing*1.2 应王元元的要求 103,106,110上浮 20020130cheng into 212 and 160
select @bing=@bing*1.2

--106,107 不足千字按千字计算
if @ticai_id in (106,107,113,114,115,116,117,118,119,160)
begin
if (@ticai_id in (106,107)) and (@words=0)
update gaojian set totalyuan=(@job_count*@bing) where id=@id

if (@ticai_id in (106,107)) and (@words>0)
update gaojian set totalyuan=(@job_count*@bing*@words)/1000 where id=@id

if @ticai_id in (113,114,115,116,117,118,160)
update gaojian set totalyuan=(@job_count*@bing*@words)/1000 where id=@id
if (@ticai_id=119) update gaojian set totalyuan=(@job_count*@bing*@words/16) where id=@id
end
else
update gaojian set totalyuan=(@job_count*@bing) where id=@id
end
end
fetch next from cur_gaojian into @id,@ticai_id,@job_date,@job_count,@totalfen,@totalyuan,@class,
@realfirst,@realsecond,@words
end
close cur_gaojian
deallocate cur_gaojian
 
应譔是超时问题.
 
我换成adoquery即可
 
顶部