J
joinrry
Unregistered / Unconfirmed
GUEST, unregistred user!
本人在数据库编程中,用table控件动态创建了一个数据表格,代码如下:if not Table1.Exists then
begin
with Table1do
begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'DBDEMOS';
TableType := ttParadox;
TableName := 'CustInfo';
{ Next, describe the fields in the table }
with FieldDefsdo
begin
Clear;
with AddFieldDefdo
begin
Name := 'Field1';
DataType := ftInteger;
Required := True;
end;
with AddFieldDefdo
begin
Name := 'Field2';
DataType := ftString;
Size := 30;
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 := 'Field1';
Options := [ixPrimary];
end;
with AddIndexDefdo
begin
Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
但是到了要编查询功能的时候,需要获得数据表的所有字段,但一直未能如愿,请教!!!!!!!!★
begin
with Table1do
begin
{ The Table component must not be active }
Active := False;
{ First, describe the type of table and give }
{ it a name }
DatabaseName := 'DBDEMOS';
TableType := ttParadox;
TableName := 'CustInfo';
{ Next, describe the fields in the table }
with FieldDefsdo
begin
Clear;
with AddFieldDefdo
begin
Name := 'Field1';
DataType := ftInteger;
Required := True;
end;
with AddFieldDefdo
begin
Name := 'Field2';
DataType := ftString;
Size := 30;
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 := 'Field1';
Options := [ixPrimary];
end;
with AddIndexDefdo
begin
Name := 'Fld2Indx';
Fields := 'Field2';
Options := [ixCaseInsensitive];
end;
end;
{ Call the CreateTable method to create the table }
CreateTable;
end;
end;
但是到了要编查询功能的时候,需要获得数据表的所有字段,但一直未能如愿,请教!!!!!!!!★