unit U_XTMCXG;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
  cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
  cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
  cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
  cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
  RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
  cxTextEdit, cxDBLookupComboBox, cxLookAndFeels, cxLookAndFeelPainters,
  cxNavigator;

type
  TfrmXTMCXG = class(TForm)
    ToolBar1: TToolBar;
    TBRafresh: TToolButton;
    TBClose: TToolButton;
    ADOQueryTemp: TADOQuery;
    ADOQueryCmd: TADOQuery;
    Panel1: TPanel;
    ADOQueryMain: TADOQuery;
    RM1: TRMGridReport;
    RMDB_Main: TRMDBDataSet;
    cxGridPopupMenu2: TcxGridPopupMenu;
    Label1: TLabel;
    oldKH: TEdit;
    Label2: TLabel;
    newKH: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private

    { Private declarations }

  public
  end;

var
  frmXTMCXG: TfrmXTMCXG;

implementation

uses
  U_DataLink, U_Fun, U_ZDYHelp, U_FactoryInput;

{$R *.dfm}

procedure TfrmXTMCXG.FormDestroy(Sender: TObject);
begin
  frmXTMCXG := nil;
end;

procedure TfrmXTMCXG.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TfrmXTMCXG.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmXTMCXG.Button2Click(Sender: TObject);
begin
  if Trim(oldKH.Text) = '' then
  begin
    Application.MessageBox('旧名称名称不能为空!', '提示', 0);
    Exit;
  end;
  if Trim(newKH.Text) = '' then
  begin
    Application.MessageBox('新名称不能为空!', '提示', 0);
    Exit;
  end;
  with ADOQueryCmd do
  begin
    Close;
    SQL.Clear;
    sql.Add(' exec P_XT_UPKH ');
    sql.Add(' @oldKH= ' + QuotedStr(Trim(oldKH.Text)));
    sql.Add(' ,@newKH= ' + QuotedStr(Trim(newKH.text)));
    ExecSQL;
  end;
  Application.MessageBox('修改成功!', '提示', 0);
end;

end.

