首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

一个存储过程用Adoquery和adostoredproc都没有返回结果集.解决思路

2012-05-11 
一个存储过程用Adoquery和adostoredproc都没有返回结果集.SQL codeCREATEPROCEDURE pu_otest(@bppf varcha

一个存储过程用Adoquery和adostoredproc都没有返回结果集.

SQL code
CREATE   PROCEDURE pu_otest(@bppf varchar(49),@khjq datetime,@a int) ASdeclare @jcrq datetime    select @jcrq=结存日期 from stockpile where 部品品番=@bppf and convert(char(7),结存日期,121)=convert(char(7),dateadd(mm,-1,getdate()),121)    if (@jcrq is null)    begin        set @jcrq=dateadd(mm,datediff(mm,-1,dateadd(mm,-1,getdate())),-1) --上个月最后一天.    end if @a=1 begin    select  * from composing where 产品编号 in(select 产品编号 from destine                            where 交货日期>=@jcrq and 交货日期<=@khjq)  and 部品品番=@bppf --计算这段时间内各产品在构成中用到此部品的全部数量. end if @a=2  begin     select * from destine                          where 产品编号 in(select 产品编号 from composing where 部品品番=@bppf)                         and  ((交货日期>=@jcrq) and (交货日期<=@khjq)) --计算这段时间内用的此部品的预定的所有数量. endGO

Delphi(Pascal) code
    with sp1 do    begin      Close;      Prepared:=false;      ProcedureName:='pu_otest;1';      Parameters.Refresh;      Parameters.ParamByName('@bppf').Value:=Trim(cxLookupComboBox1.EditText);      Parameters.ParamByName('@khjq').Value:=cxDateEdit1.Date;      Parameters.ParamByName('@a').Value:=1;      Open;    end;      with qry3 do      begin        close;        sql.Clear;        SQL.Add('exec pu_otest :a,:b,:c,:d output');        Parameters.items[0].Value:=Trim(cxLookupComboBox1.EditText);        Parameters.items[1].Value:=cxDateEdit1.Date;        Parameters.items[2].Value:=1;        Prepared:=True;        open;;      end;



请大大们帮我看一下,我错在那里了.

[解决办法]
很久没写存储过程了。其中参数:d output,在SQL SERVER里面没有看到有output参数的定义。

热点排行