with storedproc1 do
   begin
     datestp:=ParamByName('@datestamp').AsString;
     timestp:=parambyname('@timestamp').asstring;
     execproc;
   end;
调用过程时报错:参数@datestamp不能找到。
请指教

解决方案 »

  1.   

    1 storedproc1所指的存储过程里没有@datestamp这个参数
    2 如果你是动态创建的storedproc1,调用一下CreateParameter
      

  2.   

    而且,似乎你写错了:)
    with storedproc1 do
       begin
         ParamByName('@datestamp').AsString:=datestp;
         parambyname('@timestamp').asstring:=timestp;
         execproc;
       end;
      

  3.   

    create procedure tranficon 
      @datestamp datetime,@timeStamp datetime,@interval int,@nrclass int,
      @lanenr1 int,@headw1 int,@con1 int,@num1_1 int,@num1_2 int,@num1_3 int,@gap1_1 int,@gap1_2 int,@gap1_3 int,
      @spd1_1 int,@spd1_2 int,@spd1_3 int,@len1 int,@occ1 int,@confi1 int,
      @lanenr2 int,@headw2 int,@con2 int,@num2_1 int,@num2_2 int,@num2_3 int,@gap2_1 int,@gap2_2 int,@gap2_3 int,
      @spd2_1 int,@spd2_2 int,@spd2_3 int,@len2 int,@occ2 int,@confi2 int,
      @lanenr3 int,@headw3 int ,@con3 int,@num3_1 int,@num3_2 int,@num3_3 int,@gap3_1 int,@gap3_2 int,@gap3_3 int,
      @spd3_1 int,@spd3_2 int,@spd3_3 int,@len3 int,@occ3 int,@confi3 int,
      @lanenr4 int,@headw4 int,@con4 int,@num4_1 int,@num4_2 int,@num4_3 int,@gap4_1 int,@gap4_2 int,@gap4_3 int,
      @spd4_1 int,@spd4_2 int,@spd4_3 int,@len4 int,@occ4 int,@confi4 int,
      @lanenr5 int,@headw5 int,@con5 int,@num5_1 int, @num5_2 int,@num5_3 int,@gap5_1 int,@gap5_2 int,@gap5_3 int,
      @spd5_1 int,@spd5_2 int,@spd5_3 int,@len5 int,@occ5 int,@confi5 int,
      @lanenr6 int,@headw6 int,@con6 int,@num6_1 int,@num6_2 int,@num6_3 int,@gap6_1 int,@gap6_2 int,@gap6_3 int,
      @spd6_1 int,@spd6_2 int,@spd6_3 int,@len6 int,@occ6 int,@confi6 int,
      @lanenr7 int,@headw7 int,@con7 int,@num7_1 int,@num7_2 int,@num7_3 int,@gap7_1 int,@gap7_2 int,@gap7_3 int,
      @spd7_1 int,@spd7_2 int,@spd7_3 int,@len7 int,@occ7 int,@confi7 int,
      @lanenr8 int,@headw8 int,@con8 int,@num8_1 int,@num8_2 int,@num8_3 int,@gap8_1 int,@gap8_2 int,@gap8_3 int,
      @spd8_1 int,@spd8_2 int,@spd8_3 int,@len8 int,@occ8 int,@confi8 int
    asbegin insert stamp(datestamp,timestamp,interval,nrclass,
            lanenr1,headw1,con1,num1_1,num1_2,num1_3,gap1_1,gap1_2,gap1_3,spd1_1,spd1_2,spd1_3,len1,occ1,confi1,
            lanenr2,headw2,con2,num2_1,num2_2,num2_3,gap2_1,gap2_2,gap2_3,spd2_1,spd2_2,spd2_3,len2,occ2,confi2,
            lanenr3,headw3,con3,num3_1,num3_2,num3_3,gap3_1,gap3_2,gap3_3,spd3_1,spd3_2,spd3_3,len3,occ3,confi3,
            lanenr4,headw4,con4,num4_1,num4_2,num4_3,gap4_1,gap4_2,gap4_3,spd4_1,spd4_2,spd4_3,len4,occ4,confi4,
            lanenr5,headw5,con5,num5_1,num5_2,num5_3,gap5_1,gap5_2,gap5_3,spd5_1,spd5_2,spd5_3,len5,occ5,confi5,
            lanenr6,headw6,con6,num6_1,num6_2,num6_3,gap6_1,gap6_2,gap6_3,spd6_1,spd6_2,spd6_3,len6,occ6,confi6,
            lanenr7,headw7,con7,num7_1,num7_2,num7_3,gap7_1,gap7_2,gap7_3,spd7_1,spd7_2,spd7_3,len7,occ7,confi7,
            lanenr8,headw8,con8,num8_1,num8_2,num8_3,gap8_1,gap8_2,gap8_3,spd8_1,spd8_2,spd8_3,len8,occ8,confi8)
     values(@datestamp,@timeStamp,@interval,@nrclass,
            @lanenr1,@headw1,@con1,@num1_1,@num1_2,@num1_3,@gap1_1,@gap1_2,@gap1_3,
            @spd1_1,@spd1_2,@spd1_3,@len1,@occ1,@confi1,
            @lanenr2,@headw2,@con2,@num2_1,@num2_2,@num2_3,@gap2_1,@gap2_2,@gap2_3,
            @spd2_1,@spd2_2,@spd2_3,@len2,@occ2,@confi2,
            @lanenr3,@headw3 ,@con3,@num3_1,@num3_2,@num3_3,@gap3_1,@gap3_2,@gap3_3,
            @spd3_1,@spd3_2,@spd3_3,@len3,@occ3,@confi3,
            @lanenr4,@headw4,@con4,@num4_1,@num4_2,@num4_3,@gap4_1,@gap4_2,@gap4_3,
            @spd4_1,@spd4_2,@spd4_3,@len4,@occ4,@confi4,
            @lanenr5,@headw5,@con5,@num5_1, @num5_2,@num5_3,@gap5_1,@gap5_2,@gap5_3,
            @spd5_1,@spd5_2,@spd5_3,@len5,@occ5,@confi5,
            @lanenr6,@headw6,@con6,@num6_1,@num6_2,@num6_3,@gap6_1,@gap6_2,@gap6_3,
            @spd6_1,@spd6_2,@spd6_3,@len6,@occ6,@confi6,
            @lanenr7,@headw7,@con7,@num7_1,@num7_2,@num7_3,@gap7_1,@gap7_2,@gap7_3,
            @spd7_1,@spd7_2,@spd7_3,@len7,@occ7,@confi7,
            @lanenr8,@headw8,@con8,@num8_1,@num8_2,@num8_3,@gap8_1,@gap8_2,@gap8_3,
            @spd8_1,@spd8_2,@spd8_3,@len8,@occ8,@confi8)
    end; 
      

  4.   

    对,错了
    是这样调用的。
    with storedproc1 do
       begin
         ParamByName('@datestamp').AsString:=datestp;
         parambyname('@timestamp').asstring:=timestp;
         execproc;
       end;
      

  5.   

    怎么样在delphi中定义存储过程参数?谢谢
      

  6.   

    with storedproc1 do
       begin
         Parameters.CreateParameter('@datestamp',ftstring,pdinput,20,datestp);
         Parameters.CreateParameter('@timestamp',ftstring,pdinput,20,timestp);
         execproc;
       end;
      

  7.   

    with storedproc1 do
        begin
            parameters.Refresh;
            parameters[1].Value:=datestp;
            parameters[2].Value:=timestp;
            ExecProc;
        end;
      

  8.   

    with storedproc1 do
        begin
            parameters.Refresh;
            parameters[1].Value:=datestp;
            parameters[2].Value:=timestp;
            ExecProc;
        end;