main.pas

来自「《Delphi开发人员指南》配书原码」· PAS 代码 · 共 46 行

PAS
46
字号
unit Main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

uses DB, DBTables;

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TTable.Create(Self) do begin       // create TTable object
    DatabaseName := 'c:\temp';            // point to directory or alias
    TableName := 'FOO';                   // give table a name
    TableType := ttParadox;               // make a Paradox table
    with FieldDefs do begin
      Add('Age', ftInteger, 0, True);     // add an integer field
      Add('Name', ftString, 25, False);   // add a string field
      Add('Weight', ftFloat, 0, False);   // add a floating-point field
    end;
    { create a primary index on the Age field... }
    IndexDefs.Add('', 'Age', [ixPrimary, ixUnique]);
    CreateTable;                          // create the table
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?