存储过程:
CREATE PROCEDURE SP_TJCount  ----计算@NUnit char(10),
@DPay Datetime,
@SCount Char(10) OUTPUT,
@DYLCount char(10) OUTPUT,
@DYNCount char(10) OUTPUT,
@DSYCount char(10) OUTPUT,
@DGSCount char(10) OUTPUT,
@DNGCount char(10) OUTPUT,
@DGZJCount char(10) OUTPUT,
@DDLCount char(10) OUTPUT,
@DQTCount char(10) OUTPUT,
@GYLCount char(10) OUTPUT,
@GSYCount char(10) OUTPUT,
@GDBCount char(10) OUTPUT,
@GGZJCount char(10) OUTPUT,
@GQTCount char(10) OUTPUTAs(Select @SCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay)
(Select @DYLCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USYL>0)
(Select @DYNCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USYN>0)
(Select @DSYCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USSY>0)
(Select @DGSCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USGS>0)
(Select @DNGCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USNG>0)
(Select @DGZJCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USGZJ>0)
(Select @DDLCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USDL>0)
(Select @DQTCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and USQT>0)
(Select @GYLCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and GYL>0)
(Select @GSYCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and GSY>0)
(Select @GDBCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and GDB>0)
(Select @GGZJCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and GGZJ>0)
(Select @GQTCount=Count(*) from VCFinance where NUnit=@NUnit and DPay=@DPay and GQT>0)
GO调用过程:
var
 CDYL:String;
begin
 with Datam.ADOStoredProc1 do
 begin
  close;
  ProcedureName:='SP_TJCount';// 存储过程名
  Parameters.Refresh();//刷新参数列表
  Parameters.ParamByName('@NUnit').Value:='D001';
  Parameters.ParamByName('@DPay').Value:='2003-10-1';
  //Parameters.ParamByName('@NUnit').Value:=trim(EUNAgent.Text);
  //Parameters.ParamByName('@DPay').Value:=''+Formatdatetime('yyyy-mm-1',DPDPay.Date)+'';
 try
  //ExecProc();
  OPen;//执行
  CDYL:=ParamByName('SCount').Value;
  //CDYN:=Parameters.ParamByName('DYNCount').Value;
 Finally
  close;
 end;
 end;
end;现在我只试一个@SCount这个参数,,老提示我没这个参数!!请各位帮助!

解决方案 »

  1.   

    ProcedureName:='SP_TJCount';// 存储过程名
      Parameters.Refresh();//刷新参数列表
      Parameters.ParamByName('@NUnit').Value:='D001';
      Parameters.ParamByName('@DPay').Value:='2003-10-1';
      //Parameters.ParamByName('@NUnit').Value:=trim(EUNAgent.Text);
      //Parameters.ParamByName('@DPay').Value:=''+Formatdatetime('yyyy-mm-1',DPDPay.Date)+'';
     try
      //ExecProc();
    干吗你要反复赋值???????
      

  2.   

    try this:
    CDYL:=ParamByName('@SCount').Value;
      

  3.   

    adostoredproc1.Parameters的属性是否设置正确。