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

Delphi控件源码

开发平台:

Delphi

  1. unit xt_rz_bjs;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Buttons, ComCtrls, DB, DBClient, XPBarMenu;
  6. type
  7.   Txt_rz_bj = class(TForm)
  8.     PageControl1: TPageControl;
  9.     TabSheet1: TTabSheet;
  10.     TabSheet2: TTabSheet;
  11.     Label1: TLabel;
  12.     DateTimePicker1: TDateTimePicker;
  13.     Label2: TLabel;
  14.     Label3: TLabel;
  15.     DateTimePicker2: TDateTimePicker;
  16.     Label4: TLabel;
  17.     UpDown1: TUpDown;
  18.     Edit1: TEdit;
  19.     SpeedButton1: TSpeedButton;
  20.     SpeedButton2: TSpeedButton;
  21.     ClientDataSet1: TClientDataSet;
  22.     DataSource1: TDataSource;
  23.     XPBarMenu1: TXPBarMenu;
  24.     procedure SpeedButton2Click(Sender: TObject);
  25.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  26.     procedure FormCreate(Sender: TObject);
  27.     procedure SpeedButton1Click(Sender: TObject);
  28.     procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34. var
  35.   xt_rz_bj: Txt_rz_bj;
  36. implementation
  37. uses xt_rzs;
  38. {$R *.dfm}
  39. procedure Txt_rz_bj.SpeedButton2Click(Sender: TObject);
  40. begin
  41.  close;
  42. end;
  43. procedure Txt_rz_bj.FormClose(Sender: TObject; var Action: TCloseAction);
  44. begin
  45.   action:=cafree;
  46.   xt_rz_bj:=nil;
  47. end;
  48. procedure Txt_rz_bj.FormCreate(Sender: TObject);
  49. begin
  50.  Clientdataset1.Active:=true;
  51. end;
  52. procedure Txt_rz_bj.SpeedButton1Click(Sender: TObject);
  53. var begin_time,end_time:string;
  54. begin
  55.  Clientdataset1.Close;
  56.  Clientdataset1.CommandText:='select * from xt_rz';
  57.  Clientdataset1.Open;
  58.  begin_time:=datetimetostr(DateTimePicker1.DateTime);
  59.  end_time:=datetimetostr(DateTimePicker2.DateTime);
  60.  case PageControl1.ActivePageIndex of
  61.   0: begin
  62.       if Clientdataset1.RecordCount=0 then
  63.         begin
  64.           application.MessageBox('当前表中没有数据'+#13#10+'不能删除','提示',mb_ok+mb_iconinformation);
  65.           exit;
  66.         end;
  67.      if  application.MessageBox('您确定要删除日志吗?','警告',mb_okcancel+mb_iconquestion)=Idok then
  68.         begin
  69.           Clientdataset1.Close;
  70.           Clientdataset1.CommandText:='P_rz'+''''+edit1.text+''''+'';
  71.           Clientdataset1.execute;
  72.           Clientdataset1.close;
  73.           Clientdataset1.CommandText:='select * from xt_rz';
  74.           Clientdataset1.Open;
  75.           xt_rz.ToolButton4.click;
  76.          end;//end if
  77.      end;
  78.   1: begin
  79.       if Clientdataset1.RecordCount=0 then
  80.         begin
  81.           application.MessageBox('当前表中没有数据'+#13#10+'不能删除','提示',mb_ok+mb_iconinformation);
  82.           exit;
  83.         end;
  84.       if  application.MessageBox('您确定要删除日志吗?','警告',mb_okcancel+mb_iconquestion)=Idok then
  85.         begin
  86.           Clientdataset1.Close;
  87.           clientdataset1.CommandText:='delete xt_rz where rz_czsj>='+''''+begin_time+''''+' and rz_czsj<='+''''+end_time+''''+'';
  88.           Clientdataset1.Execute;
  89.           Clientdataset1.Close;
  90.           Clientdataset1.CommandText:='select * from xt_rz';
  91.           Clientdataset1.Open;
  92.           xt_rz.ToolButton4.click;
  93.         end;//end if
  94.      end;
  95.  end;//end case
  96. end;
  97. procedure Txt_rz_bj.UpDown1Click(Sender: TObject; Button: TUDBtnType);
  98. var i:integer;
  99. begin
  100.  I:=StrToInt(edit1.Text);
  101.  inc(i);
  102.  edit1.Text:=IntToStr(I);
  103. end;
  104. end.