我建立了一个ADO表,但不知怎么清空它。Table有EmptyTable属性,而ADO表却没有。用它的Adotable1.DeleteRecords();却提示“操作内容不可访问”,难道就没有什么好的办法吗?目前,我是用的
adotable1.first;
while not adotable1.eof do 
begin
  adotable1.delete;
  adotable1.next;
end;
adotable1.delete;
总感到很笨。

解决方案 »

  1.   

    我建立了一个ADO表,但不知怎么清空它
    ===================================
    对于ado连接,清空表最好的办法是用command对象.
    with command do
    begin
      commandtext :='delete from tablename';
      execute;
    end;
      

  2.   

    adotable1.first;
    while not adotable1.eof do 
    begin
      adotable1.delete;
    //  adotable1.next; 不要這一句﹐
    end;
    //adotable1.delete; 不要這一句
    這樣肯定可以﹗我有試過﹗
      

  3.   

    你这样慢死了,delete from table.
    之后在adotable.refresh.快得很.写起来液不是很麻烦
      

  4.   

    with adoquery do
    begin
      close;
      sql.clear;
      sql.add ('delete from tablename');
      execute;
    end;
      

  5.   

    with adoquery do
    begin
      close;
      sql.clear;
      sql.add ('delete from tablename where .....');//条件自己加
      execute;
    end;