home *** CD-ROM | disk | FTP | other *** search
- unit Main;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, Buttons, StdCtrls, Grids, DBGrids, DB;
-
- type
- TForm1 = class(TForm)
- Button1: TButton;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- Label1: TLabel;
- ListBox1: TListBox;
- BitBtn1: TBitBtn;
- procedure Button1Click(Sender: TObject);
- procedure FormClose(Sender: TObject; var Action: TCloseAction);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- uses
- DBTables;
-
- {$R *.DFM}
-
- var
- Table1:TTable;
-
- procedure TForm1.Button1Click(Sender: TObject);
- var
- i:integer;
- begin
- if Table1=nil then
- Table1:=TTable.Create(nil);
- with Table1 do
- begin
- DatabaseName:='dbdemos';
- TableName:='mytest';
- TableType:=ttParadox;
- {╤ετΣα≥ⁿ ∩εδ }
- with FieldDefs do
- begin
- Add('Surname',ftString,30,true);
- Add('Name',ftString,25,true);
- Add('Patronymic',ftString,25,true);
- Add('Age',ftInteger,0,false);
- Add('Weight',ftFloat,0,false);
- end;
- {╤πσφσ≡Φ≡εΓα≥ⁿ ΦφΣσΩ±√}
- with IndexDefs do
- begin
- Add('I_Name','Surname;Name;Patronymic',[ixPrimary,ixUnique]);
- Add('I_Age','Age',[ixCaseInsensitive]);
- end;
- CreateTable;
- end;
- DataSource1.DataSet:=Table1;
- Table1.Open;
- {╬≥εß≡ατΦ∞ ΦφΣσΩ±√ Σδ ∩≡ε±∞ε≥≡α}
- for i:=0 to Table1.IndexDefs.Count-1 do
- begin
- with Table1.IndexDefs.Items[i] do
- ListBox1.Items.Add(Name+' ('+Fields+')');
- end;
- end;
-
- procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
- begin
- if Table1<>nil then
- Table1.Free;
- end;
-
- end.
-