Загрузил Виктор Драчев

Новый текстовый документ

реклама
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Mask, DBCtrls, StdCtrls, DB, ADODB, Grids, DBGrids, ExtCtrls,
CPort, CPortCtl;
type
TForm1 = class(TForm)
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
Button1: TButton;
Label1: TLabel;
Timer1: TTimer;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
DBGrid1: TDBGrid;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1; min, sec: integer; mins, secs: string;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ADOTable1.Insert;
ADOTable1.FieldByName('Время').AsString:=Label1.Caption;
ADOTable1.FieldByName('Дата').AsString:=Label2.Caption;
ADOTable1.Post;
ADOTable1.Refresh;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label1.Caption:=timetostr(time);
Label2.Caption:=DateToStr(Date);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DBGrid1.Columns.Items[0].Width:=0;
DBGrid1.Columns.Items[1].Width:=100;
DBGrid1.Columns.Items[2].Width:=100;
DBGrid1.Columns.Items[3].Width:=100;
DBGrid1.Columns.Items[4].Width:=100;
end;
end.
Скачать