PDA

نسخه کامل مشاهده نسخه کامل : نحوه ايجاد يك جدول اطلاعاتي پارادكس از طريق كد برنامه دلفي



hashem_te
14-05-2006, 10:19
چگونه ميتوان يك جدول اطلاعاتي پارادكس با ساختار مشخص از طريق كد برنامه دلفي ايجاد كرد
مثلا بر اساس ساختار جدول اكسس كه توسط AdoConnection به آن متصل شده ايم

NoneForce
14-05-2006, 11:12
سلام
بايد روال زير مي تونيد اين كار را انجام دهيد :

Uses DBTables, DB;

procedure CreateATable(DBName, //Alias or path
TblName : String ; //Table Name to Create
TblType : TTableType); //ttDefault, ttParadox, ttDBase, ttASCII
var
tbl : TTable;
begin
tbl := TTable.Create(Application);
with tbl do begin
Active := False;
DatabaseName := DBName;
TableName := TblName;
TableType := TblType;
with FieldDefs do begin
Clear;
Add('LastName', ftString, 30, False);
Add('FirstName', ftString, 30, False);
Add('Address1', ftString, 40, False);
Add('Address2', ftString, 40, False);
Add('City', ftString, 30, False);
Add('ST', ftString, 2, False);
Add('Zip', ftString, 10, False);
end;

{Add a Primary Key to the table}
with IndexDefs do begin
Clear;
Add('Field1Index', 'LastName;FirstName', [ixPrimary, ixUnique]);
end;

CreateTable; {Make the table}
end;
end;

روش فراخواني :
CreateATable('D:\','tblTest',ttParadox)

TableType :
ttDefault (Default) Determine table type based on file extension for the table.
ttParadox Table is a Paradox table.
ttDBase Table is a dBASE table.
ttFoxPro Table is a FoxPro table.
ttASCII Table is a text file with comma-delimited, quoted strings for each field