怎样用程序在磁盘生成 *.dbf 数据库文件?(50分)

  • 主题发起人 主题发起人 teleman
  • 开始时间 开始时间
T

teleman

Unregistered / Unconfirmed
GUEST, unregistred user!
数据库文件中包括 字段,索引。
谢谢!
 
if not Table1.Exists then begin
with Table1 do begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'DBDEMOS';
TableType := ttDBase;
TableName := 'CustInfo';
{ Next, describe the fields in the table }
with FieldDefs do begin
Clear;
with AddFieldDef do begin

Name := 'Field1';
DataType := ftInteger;
Required := True;
end;
with AddFieldDef do begin
Name := 'Field2';
DataType := ftString;
Size := 30;
end;
end;
{ Next, describe any indexes }
with IndexDefs do begin
Clear;
{ The 1st index has no name because it is
{ a Paradox primary key }
with AddIndexDef do begin

Name := '';
Fields := 'Field1';
Options := [ixPrimary];
end;
with AddIndexDef do begin
Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
 
agree gxg8816,其实delphi 4/5下已有你所要求的例子
 
在DELPHI的帮助中搜索“TTABEL.CREATETABLE”,那里有详细的例子。
 
后退
顶部