⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.~pas

📁 Delphi数据库编程
💻 ~PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, DBTables;

type
  TForm1 = class(TForm)
    Table1: TTable;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  Curdir:string;
begin
  table1.Close;
  Table1.DatabaseName:='RYGL';
  Table1.TableName :='RYGL.db';
  Table1.TableType :=ttParadox;
  if not table1.Exists then
     begin
        with table1 do  begin
                with FieldDefs do  begin
                     clear;
                     AddFieldDef.Name:='BH';
                     AddFieldDef.DataType:=ftString;
                     AddFieldDef.Required:=True;
                     AddFieldDef.Size:=8;
                     with AddFieldDef do  begin
                         Name:='XM';
                         DataType:=ftString;
                         Required:=True;
                         Size:=10;
                     end;
                     with AddFieldDef do  begin
                         Name:='NL';
                         DataType:=ftInteger;
                     end;
                     with AddFieldDef do  begin
                         Name:='HF';
                         DataType:=ftBoolean;
                     end;
               end;
               with IndexDefs do begin
                   clear;
                   with Addindexdef do begin
                       Name:='BH';
                       Fields:='编号';
                       Options:=[ixPrimary];
                   end;
                   with Addindexdef do begin
                       Name:='XM';
                       Fields:='编号';
                   end;
               end;
               CreateTable;
           end;
     end;


end;

end.

⌨️ 快捷键说明

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