xt_rzs.~pas
上传用户:szruida
上传日期:2007-06-01
资源大小:6518k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit xt_rzs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ComCtrls, ToolWin, DB, Grids, DBGridEh, XPBarMenu, PrnDbgeh,
  6.   ExtCtrls, DBClient;
  7. type
  8.   Txt_rz = class(TForm)
  9.     CoolBar1: TCoolBar;
  10.     ToolBar1: TToolBar;
  11.     ToolButton1: TToolButton;
  12.     ToolButton3: TToolButton;
  13.     ToolButton4: TToolButton;
  14.     ToolButton2: TToolButton;
  15.     DataSource1: TDataSource;
  16.     ToolButton6: TToolButton;
  17.     XPBarMenu1: TXPBarMenu;
  18.     PrintDBGridEh1: TPrintDBGridEh;
  19.     Panel1: TPanel;
  20.     DBGridEh1: TDBGridEh;
  21.     ClientDataSet1: TClientDataSet;
  22.     procedure FormCreate(Sender: TObject);
  23.     procedure ToolButton3Click(Sender: TObject);
  24.     procedure ToolButton4Click(Sender: TObject);
  25.     procedure ToolButton6Click(Sender: TObject);
  26.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  27.     procedure ToolButton2Click(Sender: TObject);
  28.     procedure ToolButton1Click(Sender: TObject);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34. var
  35.   xt_rz: Txt_rz;
  36. implementation
  37. uses Dms, xt_rz_bjs;
  38. {$R *.dfm}
  39. procedure Txt_rz.FormCreate(Sender: TObject);
  40. begin
  41.   Clientdataset1.Active:=true;
  42. end;
  43. procedure Txt_rz.ToolButton3Click(Sender: TObject);
  44. begin
  45.  if xt_rz_bj=nil then
  46.   begin
  47.     xt_rz_bj:=Txt_rz_bj.create(self);
  48.     xt_rz_bj.showmodal;
  49.   end;  
  50. end;
  51. procedure Txt_rz.ToolButton4Click(Sender: TObject);
  52. begin
  53.  Clientdataset1.Close;
  54.  Clientdataset1.CommandText:='select * from xt_rz';
  55.  Clientdataset1.Open;
  56. end;
  57. procedure Txt_rz.ToolButton6Click(Sender: TObject);
  58. begin
  59.  close;
  60. end;
  61. procedure Txt_rz.FormClose(Sender: TObject; var Action: TCloseAction);
  62. begin
  63.  Clientdataset1.Active:=false;
  64.  action:=cafree;
  65.  xt_rz:=nil;
  66. end;
  67. procedure Txt_rz.ToolButton2Click(Sender: TObject);
  68. begin
  69.   printdbgrideh1.Title.Text:='系统日志表';
  70.   printdbgrideh1.AfterGridText.Text:=datetostr(date);
  71.   printdbgrideh1.Preview;
  72. end;
  73. procedure Txt_rz.ToolButton1Click(Sender: TObject);
  74. begin
  75.   if Clientdataset1.RecordCount=0 then
  76.         begin
  77.           application.MessageBox('当前表中没有数据'+#13#10+'不能删除','提示',mb_ok+mb_iconinformation);
  78.           exit;
  79.       end;
  80.   if application.MessageBox('您确定要清除所有日志吗?','警告',mb_ok+mb_iconinformation)=Idok then
  81.    begin
  82.      Clientdataset1.Close;
  83.      Clientdataset1.CommandText:='delete xt_rz where rz_xh<>'+''''+''''+'';
  84.      Clientdataset1.Execute;
  85.      Clientdataset1.Close;
  86.      Clientdataset1.CommandText:='select * from xt_rz';
  87.      Clientdataset1.Open;
  88.    end;
  89. end;
  90. end.