|
我的存储过程检查时是没有语法错误的,可是在DELPHI调用时却提示没有执行可选特性!是怎么回事啊?
存储过程代码如下:
CREATE PROCEDURE hyz_tj
@sta_date datetime,
@end_date datetime,
@result int output
AS
select k.phid ,k.sqz,k.sjdf,k.zfss,k.jlss into #lsb from ysjlrb as k where k.bb='甲班' and k.rj between @sta_date and @end_date order by k.phid
select #lsb.phid,avg(#lsb.sqz) as lssq,avg(#lsb.df) as lsdf,sum(#lsb.zfss) as lstp,sum(#lsb.jlss) as lsce into #lsbfcb from #lsb group by phid
update bfcb set bfcb.jbsj=#lsbfcb.lssq,bfcb.jbdf=#lsbfcb.lsdf,bfcb.jbtpss=#lsbfcb.lstp,bfcb.jbcess=#lsbfcb.lsce from bfcb,#lsbfcb where bfcb.phid=#lsbfcb.phid
select k.phid ,k.sqz,k.sjdf,k.zfss,k.jlss into #lsba from ysjlrb as k where k.bb='乙班' and k.rj between @sta_date and @end_date order by k.phid
select #lsba.phid,avg(#lsba.sqz) as lssq,avg(#lsba.df) as lsdf,sum(#lsba.zfss) as lstp,sum(#lsba.jlss) as lsce into #lsbfcba from #lsba group by phid
update bfcb set bfcb.jbsj=#lsbfcba.lssq,bfcb.jbdf=#lsbfcba.lsdf,bfcb.jbtpss=#lsbfcba.lstp,bfcb.jbcess=#lsbfcba.lsce from bfcb,#lsbfcba where bfcb.phid=#lsbfcba.phid
select k.phid ,k.sqz,k.sjdf,k.zfss,k.jlss into #lsbb from ysjlrb as k where k.bb='丙班' and k.rj between @sta_date and @end_date order by k.phid
select #lsbb.phid,avg(#lsbb.sqz) as lssq,avg(#lsbb.df) as lsdf,sum(#lsbb.zfss) as lstp,sum(#lsbb.jlss) as lsce into #lsbfcbb from #lsbb group by phid
update bfcb set bfcb.jbsj=#lsbfcbb.lssq,bfcb.jbdf=#lsbfcbb.lsdf,bfcb.jbtpss=#lsbfcbb.lstp,bfcb.jbcess=#lsbfcbb.lsce from bfcb,#lsbfcbb where bfcb.phid=#lsbfcbb.phid
select @result=0
return
GO
DELPHI调用如下:
procedure Thyz_bfc.BT_tjClick(Sender: TObject);
var
result:integer;
sta_date,end_date:Tdatetime;
begin
sta_date := DTP_sta.DateTime;
end_date := DTP_end.DateTime;
ADOSP_bfc.Close;
ADOSP_bfc.ProcedureName:='hyz_tj';
ADOSP_bfc.Parameters.Clear;
ADOSP_bfc.Parameters.Refresh;
ADOSP_bfc.Parameters.CreateParameter('@result',ftinteger,pdoutput,4,0);
ADOSP_bfc.Parameters.CreateParameter('@sta_date',ftdatetime,pdinput,8,sta_date);
ADOSP_bfc.Parameters.CreateParameter('@end_date',ftdatetime,pdinput,8,end_date);
ADOSP_bfc.Prepared := True;
ADOSP_bfc.ExecProc;
result := ADOSP_bfc.Parameters.ParamByName('@result').Value;
end; |
|