Unit1.~pas
上传用户:autowell
上传日期:2022-06-21
资源大小:16754k
文件大小:1k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit Unit1;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, DB, DBTables,  StdCtrls,
  6.   ADODB, Mask;
  7. type
  8.   TForm1 = class(TForm)
  9.     Label1: TLabel;
  10.     DataSource1: TDataSource;
  11.     ADOConnection1: TADOConnection;
  12.     DBGrid1: TDBGrid;
  13.     DBNavigator1: TDBNavigator;
  14.     ADOQuery1: TADOQuery;
  15.     DBEdit1: TDBEdit;
  16.     DBEdit2: TDBEdit;
  17.     DBEdit3: TDBEdit;
  18.     Button1: TButton;
  19.     Button2: TButton;
  20.     Edit1: TEdit;
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure Button2Click(Sender: TObject);
  23.     procedure Edit1Change(Sender: TObject);
  24.   private
  25.     { Private declarations }
  26.   public
  27.     { Public declarations }
  28.   end;
  29. var
  30.   Form1: TForm1;
  31. implementation
  32. {$R *.dfm}
  33. procedure TForm1.Button1Click(Sender: TObject);
  34. begin
  35.     ADOQuery1.active:=true;
  36. end;
  37. procedure TForm1.Button2Click(Sender: TObject);
  38. begin
  39.       ADOQuery1.active:=false;
  40. end;
  41. procedure TForm1.Edit1Change(Sender: TObject);
  42. begin
  43.     if edit1.Text<>'xiaobai' then
  44.      DBNavigator1.VisibleButtons:=[nbFirst,nbPrior,nbNext,nblast]
  45.      else  DBNavigator1.VisibleButtons:=[nbFirst,nbPrior,nbNext,nbLast,nbInsert,nbDelete,nbEdit,nbPost,nbCancel,nbRefresh]
  46. end;
  47. end.