存储过程如下:
CREATE PROCEDURE QueryCustomerID
  @customer_id       VARCHAR(3)  = NULL   --客户编号
WITH ENCRYPTION
AS--判断客户编号是否存在
if not exists ( select * from CustomerInformation where customer_id = @customer_id )
    return '此客户编号不存在'
go 调用存储过程:
 with dm.ADOStoredProc1 do
  begin
    Close;
    ProcedureName:='QueryCustomerID';
    Parameters.Refresh();
    Parameters.CreateParameter('@customer_id',ftstring,pdoutput,3,0);
    Prepared;
    Parameters.ParamValues['@customer_id'].Value := edtLayOuter.Text;
    ExecProc;
    if Parameters.ParamByName('@customer_id').value <> '' then showmessage(Parameters.ParamByName('@customer_id').value);
  end;
程序报错:Invalid variant operation请问 问题出在什么地方?

解决方案 »

  1.   

    语法
    RETURN [ integer_expression ]参数
    integer_expression是返回的整型值。存储过程可以给调用过程或应用程序返回整型值。
      

  2.   

    CREATE PROCEDURE QueryCustomerID
      @customer_id       VARCHAR(3)  = NULL   --客户编号
    WITH ENCRYPTION
    AS--判断客户编号是否存在
    if not exists ( select * from CustomerInformation where customer_id = @customer_id )
        return 6
    return
    go 调用存储过程:
     with dm.ADOStoredProc1 do
      begin
        Close;
        ProcedureName:='QueryCustomerID';
        Parameters.Refresh;
        Prepared;
        Parameters.ParamValues['@customer_id'].Value := edtLayOuter.Text;
        ExecProc;
        if Parameters.ParamByName('@RETURN_VALUE).value =6  then
        showmessage('此客户编号不存在');
      end;
      

  3.   

    herofy(雄鸡破晓)的方法好象还是有问题
      

  4.   

    对了,给存储过程付付值是这样
    ProcedureName:='QueryCustomerID;1';