如何使用 AdsCopyTableStructure 创建 ttAdsCDX 表

发布于 2024-10-02 09:59:48 字数 280 浏览 0 评论 0原文

使用 Advantage Server 9x,我尝试使用以下代码创建 DBF/CDX 表结构的副本:

table1.AdsCopyTableStructure(d.AdsConnectionTemp.connectPath+'table.dbf');

创建的表的类型为 ttAdsADT,即使原始表是 ttAdsCDX。

我尝试在结果表上使用 AdsConvertTable,但它弹出一个异常,抱怨该操作无法在空闲表上完成。

有办法做到这一点吗?

Using Advantage Server 9x, I am trying to create a copy of a DBF/CDX table structure using the following code:

table1.AdsCopyTableStructure(d.AdsConnectionTemp.connectPath+'table.dbf');

The table that is created is of the type ttAdsADT, even though the original table is ttAdsCDX.

I tried using AdsConvertTable on the resulting table, but it pops an exception complaining that the operation cannot be done on free tables.

Any way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

初心 2024-10-09 09:59:48

我无法让这个函数工作,但通过使用以下代码想出了一个解决方法:

 t:=TAdsTable.create(nil);
 try
      t.AdsTableOptions.AdsFilterOptions:=RESPECT_WHEN_COUNTING;
      t.open;
      t.AdsSetAOF('keyval=-1'); // gives an empty result
      t.AdsCopyTable('c:\somewhere\emlt.dat');
      t.close;
 finally
      freeAndNil(t);
 end;

I was not able to get this function to work, but came up with a work around by using the following code:

 t:=TAdsTable.create(nil);
 try
      t.AdsTableOptions.AdsFilterOptions:=RESPECT_WHEN_COUNTING;
      t.open;
      t.AdsSetAOF('keyval=-1'); // gives an empty result
      t.AdsCopyTable('c:\somewhere\emlt.dat');
      t.close;
 finally
      freeAndNil(t);
 end;
一萌ing 2024-10-09 09:59:48

你有几个选择。
如果您不介意有一条记录,您可以随时执行

Select top 1 * into mynewtable.dbf from oldtable ,

这很快

第二个选项是执行第一种方法,将其保存到 adt 文件(这是默认值)然后打开该表并使用 ADSConvertTable 函数创建 DBF。

ADTTable.ADSTableConvert('dbftable.dbf',ttADSCDX);

You have a couple of options.
If you don't mind having a single record you can always do

Select top 1 * into mynewtable.dbf from oldtable

which is quick

A second option would be to do your first method, saving it to an adt file (which is the default) then open THAT table and use ADSConvertTable function to create the DBF.

ADTTable.ADSTableConvert('dbftable.dbf',ttADSCDX);

独夜无伴 2024-10-09 09:59:48
QDSPRINTLIG.AdsConvertTable(gcTmpDir + gcTempFile + '.dbf',ttADSCDX);

13 年后它仍然有效:))

QDSPRINTLIG.AdsConvertTable(gcTmpDir + gcTempFile + '.dbf',ttADSCDX);

It is still working after 13 years :))

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文