用 adoquery 控件,,一次删除表中的所有纪录,,,,
ADOQUERY.DELECTRECORDS(ARALL) ; 怎么不可以呢??
需要怎么写,请老师们给写出。谢谢!!

解决方案 »

  1.   

    ADOQuery1.First;
    while not ADOQuery1.Eof do
      Delete;
      

  2.   

    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('delete from tablename');
    adoquery1.excute;
      

  3.   

    请问 ,adoquery1.deleterecords() 怎么用啊!!
      

  4.   

    TRUNCATE TABLE mytableDROP TABLE mytable
    CREATE TABLE mytable()   hehe!
      

  5.   

    TAffectRecords = (arCurrent, arFiltered, arAll, arAllChapters);arCurrent Only the deletes the current record.
    arFiltered Only deletes records accessible through the current filter.
    arAll Deletes all records in the recordset.
    arAllChapters Deletes records in all chapters (ADO chapters)
      

  6.   

    adoquery1.deleterecords(arAll); //Now maybe the table is cleared!
    Thank you for asking me for help .
      

  7.   

    我使用adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('delete from tablename');
    adoquery1.open;
    出现以下的错误,怎么回事呢?/??
    project buding.exe raised exeption class eddatabaseerror
    with message 'aodquery1:commandtext does not returm a result
    set',process stopped , use step or run to continye 
    老师们!!!
      

  8.   

    楼上的错误是因为你用错了,应将adoquery1.open
    改为adoquery1.execSQL;就可以了
    open是需要返回值的,而
    execSQL不需要。
    但open也能执行过去,你执行一次就会发现该表中的记录已删除!
      

  9.   

    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('delete from tablename');
    adoquery1.excute;
      

  10.   

    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('delete from tablename');
    adoquery1.execsql 出现这样的错误
    project buding.exe raised exception class eaccessviolation 
    with message 'access violation at address 1f487cab in module
    'maado15.dll ' .write of address 02ba8008'.process stopped
    use step or run to continue 
      

  11.   

    没有这个语句的   adoquery1.excute;
    没有 excute
      

  12.   

    adoquery1.deleterecords(arAll); 为什么不能彻底删除呢??为什么出错呢?//
      

  13.   

    出错了阿,,smaze 老师,你看上面我写的错误了吗??
      

  14.   

    delphi的bug层出不穷,,这只是其中一个,,你可以避开,想其他的办法.
      

  15.   

    就用这个:TRUNCATE TABLE tablenameAdoQuery1.sql.clear
    ADOQuery1.sql.add('TRUNCATE TABLE mytable')
    ADOQuery1.ExecSql
      

  16.   

    I am sorry for listen that.
     
    Now look for online help of Delphi please.You can get the result by yourself.
      

  17.   

    这是帮助里的摘录:If the recordset does not support record deletions, an exception is raised. Use the Supports method to determine whether the recordset supports deleting records.
    猜测:是否TADOQuery不支持,使用Supports方法看看。
    具体看帮助。