zoukankan      html  css  js  c++  java
  • Delphi 使用TAdoQuery执行存储过程的样例

    procedure TCustomerForm.FindCustomerInfo;
    var
      strSql:string;
    begin

     //  BL_HV_FindCustomerInfo 存储过程的名称,后面是需要的全部的参数
      strSql:='exec BL_HV_FindCustomerInfo :StyleInt,:CustomerName,:RelationName,'
             +':RelationPhone,:Address,:CustomerStatus,:ErrorCode output,:ErrorMessage output';


      with adoQryCustomer do
      begin
        Close;
        SQL.Clear;
        SQL.Add(strSql);
        if rbOr.Checked = True then
          Parameters.ParamByName('StyleInt').Value := '0'
        else
          Parameters.ParamByName('StyleInt').Value := '1';
        Parameters.ParamByName('CustomerName').Value := Trim(edtFindCustomerName.Text);
        Parameters.ParamByName('RelationName').Value := Trim(edtFindRelationName.Text);
        Parameters.ParamByName('RelationPhone').Value := Trim(edtFindRelationPhone.Text);
        Parameters.ParamByName('Address').Value := Trim(edtFindAddress.Text);
        if cbFindCustomerStatus.Checked then
        Parameters.ParamByName('CustomerStatus').Value :=1
        else
        Parameters.ParamByName('CustomerStatus').Value :=0;
        ExecSQL;
        ErrorCodeStr := Parameters.ParamByName('ErrorCode').Value;

        if ErrorCodeStr <> '0' then
          ShowMessage(Parameters.ParamByName('ErrorMessage').Value)
        else
          Active := True;
      end;
      if dbgrdhCustomer.CanFocus then
        dbgrdhCustomer.SetFocus;
    end;

    转自:https://blog.csdn.net/xiongmao000738/article/details/6956094

  • 相关阅读:
    作业2 四则运算
    自动生成小学四则运算题目(加强版)
    Oracle 转移符问题
    《一个程序猿的生命周期》有感
    自问自答总结
    The Last Reader Response——13-17
    读《构建之法》十一、十二章有感
    《构建之法》8,9,10,章有感
    第二天冲刺(个人工作)
    冲刺第一天(个人工作)
  • 原文地址:https://www.cnblogs.com/railgunman/p/9549101.html
Copyright © 2011-2022 走看看