我使用的是BDE数据库引擎,Table组件,其中Name属性是:tab_table,DataName属性是:tab.db,Active属性:true.我建这个表是用于暂存数据的,当添加完一些设备信息后,要打印出每个设备标签,我把标签上需要的一些信息存入此表,打印完后清空此表,以利于下次使用此表。我使用以下语句清空此表,但是运行出错:
if tab_table.Active then
 begin
    tab_table.close;
    tab_table.EmptyTable;
    tab_table.open;
 end;
错误提示是:
Project EMS.exe are raised excption class EDBEngineError with message'
Table:D:\EMS\TAB.db
User:wanli',Process stopped.Use step or Run to continue
请各位高手相助,错在哪里?有没有其他的解决方案?

解决方案 »

  1.   

    1。你的表加密了吗,如果加密了码,先去密码 
    2。 if tab_table.Active then
     begin
        tab_table.close;
        tab_table.TableType := ttParadox;//////
        tab_table.EmptyTable;
        tab_table.open;
     end;
      

  2.   

    EmptyTable必须在表达开状态下才能使用!!!tab_table.Edit;
    tab_table.EmptyTable;
    tab_table.Edit;
    tab_table.Post;
      

  3.   

    我的表没有加密;
    我把表打开表使用上述语句:
    tab_table.Edit;
    tab_table.EmptyTable;
    tab_table.Edit;
    tab_table.Post;
    还是出错,不过出错原因变了:
    出错信息是:
    Project EMS.exe are raised excption class EDBEngineError with message
    'Table canot be opened for exclusive use'
    User:wanli',Process stopped.Use step or Run to continue
    不知错在哪里?
      

  4.   

    你先这样删除一下看看有没有出错tab_table.first;
    tab_table.edit;
    while not tab_table.eof do 
      tab_table.delete;
    tab_table.post;
    如果还出错,可能你的表有外键约束
      

  5.   

    你的程序操作表的时候,有没有用DataBase desktop打开啊?如果有关掉它再试
      

  6.   

    要用table1.EmptyTable,Table1必须是独占的方式且是在Table1。Close的情况下才能正常运行的。