在程序中如何动态修改PARADOX表的结构?

野马软件 2000-05-28 03:46:00
在程序中如何动态修改PARADOX表的结构?
不胜感激!
...全文
92 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wx_zhang 2000-05-30
  • 打赏
  • 举报
回复
如果知道表的结构,完全可以删掉原来的表,重建一个新表。反正表中的数据不能保存下来了。
wx_zhang 2000-05-29
  • 打赏
  • 举报
回复
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 := ttParadox;
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;
野马软件 2000-05-29
  • 打赏
  • 举报
回复
我的意思是在一个已存在的表中永久地添加几个字段或删除几个字段,
而不是创建一个新表。望告知,非常感激!
lux21 2000-05-28
  • 打赏
  • 举报
回复
用TTable的FieldDefs

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧