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

Delphi控件源码

开发平台:

Delphi

  1. unit Unit1;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5.   Dialogs, StdCtrls, Grids, DBGrids, Mask, DBCtrls, DB, ADODB;
  6. type
  7.   TForm1 = class(TForm)
  8.     ADOConnection1: TADOConnection;
  9.     ADODataSet1: TADODataSet;
  10.     DataSource1: TDataSource;
  11.     DBEdit1: TDBEdit;
  12.     DBEdit2: TDBEdit;
  13.     DBGrid1: TDBGrid;
  14.     Label1: TLabel;
  15.     Label2: TLabel;
  16.     Button1: TButton;
  17.     Button2: TButton;
  18.     Button3: TButton;
  19.     ComboBox1: TComboBox;
  20.     Label3: TLabel;
  21.     Button4: TButton;
  22.     Button5: TButton;
  23.     Button6: TButton;
  24.     DBEdit3: TDBEdit;
  25.     Button7: TButton;
  26.     Button8: TButton;
  27.     procedure Button1Click(Sender: TObject);
  28.     procedure Button2Click(Sender: TObject);
  29.     procedure Button3Click(Sender: TObject);
  30.     procedure Button5Click(Sender: TObject);
  31.     procedure Button4Click(Sender: TObject);
  32.     procedure Button6Click(Sender: TObject);
  33.     procedure Button7Click(Sender: TObject);
  34.     procedure Button8Click(Sender: TObject);
  35.   private
  36.     { Private declarations }
  37.   public
  38.     { Public declarations }
  39.   end;
  40. var
  41.   Form1: TForm1;
  42. implementation
  43. {$R *.dfm}
  44. procedure TForm1.Button1Click(Sender: TObject);
  45. begin
  46.     Adodataset1.next;
  47. end;
  48. procedure TForm1.Button2Click(Sender: TObject);
  49. begin
  50.     dbedit1.ReadOnly:=false;
  51.     dbedit2.ReadOnly:=false;
  52.     dbedit3.ReadOnly:=false;
  53.     dbedit3.text:=combobox1.text;
  54.     adodataset1.Active:=true;
  55.     adodataset1.Edit;
  56.     adodataset1.Append;
  57. end;
  58. procedure TForm1.Button3Click(Sender: TObject);
  59. begin
  60.     close;
  61. end;
  62. procedure TForm1.Button5Click(Sender: TObject);
  63. begin
  64.     Adodataset1.First ;
  65. end;
  66. procedure TForm1.Button4Click(Sender: TObject);
  67. begin
  68.     Adodataset1.prior;
  69. end;
  70. procedure TForm1.Button6Click(Sender: TObject);
  71. begin
  72.     Adodataset1.last;
  73. end;
  74. procedure TForm1.Button7Click(Sender: TObject);
  75. begin
  76.     Adodataset1.Delete;
  77.     Adodataset1.Refresh;
  78. end;
  79. procedure TForm1.Button8Click(Sender: TObject);
  80. begin
  81.     Adodataset1.Edit;
  82.     Adodataset1.Refresh;
  83. end;
  84. end.