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

📄 unit1.pas

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

interface

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

type
  TForm1 = class(TForm)
    Table1: TTable;
    Label1: TLabel;
    ListBox1: TListBox;
    Label2: TLabel;
    Edit1: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    Edit2: TEdit;
    Edit3: TEdit;
    Label5: TLabel;
    Edit4: TEdit;
    Label6: TLabel;
    Edit5: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
   i:integer;
   Curdir:string;
begin
   getdir(0,curdir);
   Table1.Active :=False;
   table1.DatabaseName :=curdir;
   table1.Active :=True;
   For i:=0 to table1.FieldCount-1 do
      begin
         listbox1.Items.Add(table1.Fields[i].FieldName );
      end;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
begin
  Edit1.Text :=inttostr(Table1.Fieldbyname(Listbox1.Items[listbox1.ItemIndex ]).fieldNo);
  if  Table1.Fieldbyname(Listbox1.Items[listbox1.ItemIndex ]).IsIndexField  then
       edit2.Text :='true'
  else
        edit2.Text :='False';
  Edit3.Text :=inttostr(Table1.Fieldbyname(Listbox1.Items[listbox1.ItemIndex ]).Size );
  Edit4.text:=Table1.Fieldbyname(Listbox1.Items[listbox1.ItemIndex ]).AsString ;
   Edit5.Text :=inttostr(Table1.Fieldbyname(Listbox1.Items[listbox1.ItemIndex ]).DataSize  );


end;

end.

⌨️ 快捷键说明

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