请问我在使用storedProc时,database,storedProcName,params均设好后,在调用
时却说找不到该存储过程。这是什么原因?

解决方案 »

  1.   

    with form1.adostoredproc1 do
       begin
          close;
          procedurename:='mywage';
          parameters.Clear;
          parameters.CreateParameter('@lnmonth',ftInteger,pdinput,8,0);
          Parameters.ParamByName('@lnmonth').Value :=mm-1;
          try
             open;            except
             Application.MessageBox('连接数据库失败','系统提示',mb_OK);
             Application.Terminate;
          end
       end;
    {
    ----------------存储过程:mywage--------------------------
    CREATE PROCEDURE mywage   @lnmonth int
    AS
    select a.nameid,a.name,(year(getdate())-year(a.workage)+1)*5 as gl,b.dagz,b.gjj,b.ydj,
       case a.rank 
          when '技术员' then 20 
          when '助工' then 50 
          when '工程师' then 80 
          when '高工' then 100 
       end as zz
    from human a left join wage b on a.nameid=b.nameid and b.wagemonth=@lnmonth
    GO