thk

解决方案 »

  1.   

    query.close;
    query.sql.add('exec proc_name ....');
    query.open'//如果不返回数据集,用query.exec
      

  2.   

    我用adostroeproc
    然後用open;對不對?
      

  3.   

    with adoquery1 do
    begin
        Close ;
        sql.Clear ;
        SQL.Add('exec proc_personcount_month :Time,:strn');
        Parameters.ParamByName('Time').DataType := ftDate;
        Parameters.ParamByName('Time').Value := now;
        Parameters.ParamByName('strn').DataType := ftstring;
        Parameters.ParamByName('strn').Value := edit1.text;
        Prepared := True;
        try
          Open ;
        except
         exec;
        end;
        First ;
       showmessage(inttostr(adoquery6.Fields[0].AsInteger ));//显示返回值。end;哈哈,保你满意,给分吧
      

  4.   

    你可以直接将参数写进去,比如
    query.sql.add('exec pro_name ' + edit1.text + ',' + edit2.text);
    或者用parameters:
    with query1 do
    begin
    sql.add(exec proc_name :a,:b)');
    parameters.ParamByName('a').values:=edit1.text;//赋参数值
    parameters.ParamByName('b').values:=edit2.text;
    ....
    end;
      

  5.   

    adoproc的用法和上面第二种相似,不想再写了:)