X
xulu
Unregistered / Unconfirmed
GUEST, unregistred user!
用CreateTable建立一个表,建立一个索引,如何可使表中数据按降序排列,在目前情况下是升序排列.在option中加入ixDescending也不行.程序如下:
with Table1do
begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'c:/tzh/project';
TableType := ttParadox;
TableName := newproject.edit1.text;
{ Next, describe the fields in the table }
with FieldDefsdo
begin
Clear;
with AddFieldDefdo
begin
Name := '类别';
DataType := ftString;
Size := 20;
end;
with AddFieldDefdo
begin
Name := '名称';
DataType := ftString;
Size := 50;
end;
with AddFieldDefdo
begin
Name := '型号';
DataType := ftString;
Size := 30;
end;
with AddFieldDefdo
begin
Name := '单位';
DataType := ftString;
Size := 8;
end;
end;
{ Next, describe any indexes }
with IndexDefsdo
begin
Clear;
{ The 1st index has no name because it is
{ a Paradox primary key }
with AddIndexDefdo
begin
Name := '';
Fields := '类别;名称;型号;单位';
Options := [ixPrimary];
end;
with AddIndexDefdo
begin
Name := 'Fld2Indx';
Fields := '类别;名称;型号';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
with Table1do
begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'c:/tzh/project';
TableType := ttParadox;
TableName := newproject.edit1.text;
{ Next, describe the fields in the table }
with FieldDefsdo
begin
Clear;
with AddFieldDefdo
begin
Name := '类别';
DataType := ftString;
Size := 20;
end;
with AddFieldDefdo
begin
Name := '名称';
DataType := ftString;
Size := 50;
end;
with AddFieldDefdo
begin
Name := '型号';
DataType := ftString;
Size := 30;
end;
with AddFieldDefdo
begin
Name := '单位';
DataType := ftString;
Size := 8;
end;
end;
{ Next, describe any indexes }
with IndexDefsdo
begin
Clear;
{ The 1st index has no name because it is
{ a Paradox primary key }
with AddIndexDefdo
begin
Name := '';
Fields := '类别;名称;型号;单位';
Options := [ixPrimary];
end;
with AddIndexDefdo
begin
Name := 'Fld2Indx';
Fields := '类别;名称;型号';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;