Как создать таблицу базы данных, не используя Database Desktop 5
Автор: Xavier Pacheco
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.
Далее: Как сохранить содержимое таблицы в текстовый файл »»