ADOdataset 的记录删除出错!这是什么原因?

                            
unit   Unit13;   
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   StdCtrls,   DB,   ADODB,   Grids,   DBGrids;  
   
  type  
      TForm13   =   class(TForm)  
          DBGrid1:   TDBGrid;  
          ADOConnection1:   TADOConnection;  
          ADODataSet1:   TADODataSet;  
          DataSource1:   TDataSource;  
          Button1:   TButton;  
          Button2:   TButton;  
          ADOQuery1:   TADOQuery;  
          procedure   Button1Click(Sender:   TObject);  
          procedure   Button2Click(Sender:   TObject);  
          procedure   FormCreate(Sender:   TObject);  
          procedure   FormClose(Sender:   TObject;   var   Action:   TCloseAction);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
   
  var  
      Form13:   TForm13;  
   
  implementation  
   
  uses   Unit1;  
   
  {$R   *.dfm}  
   
  procedure   TForm13.Button1Click(Sender:   TObject);  
  var  
        str:string;  
  begin  
        str:='   update   memberinfo   set   book=   '   +''''+'否'+'''';  
        str:=str+   '   where   datetime<=   '+''''+   formatdatetime('yyyy-mm-dd',now())+'''';  
        str:='   select     id   as   会员编号,name   as   姓名   ,sex   as   性别,tdl   as   住址,   workdw   as   工作单位,phone   as   联系电话,member   as   会员类别,datetime   as   到期日期,borrownum   as   已借册数,book   as   允许借书   from   memberinfo   ';  
        str:=str+   '   where   datetime<=   '   +''''+formatdatetime('yyyy-mm-dd',now())+''''   ;  
   
        self.ADODataSet1.Active   :=false;  
        self.ADODataSet1.CommandText:=str;  
        self.ADODataSet1.Active   :=true;  
        self.ADODataSet1.RecordCount;  
  end;  
   
  procedure   TForm13.Button2Click(Sender:   TObject);//删除出错(提示是记录从单一的记录返回多行记录,ADODataSet1.CommandText没有返回值.)但是记录会被删除.  
  var  
        str:string;  
  begin  
      if   Application.MessageBox('确定要删除记录吗?','记录删除',4)=idyes   then  
      begin  
            str:='   delete   from   memberinfo   ';  
            str:=str+'   where   datetime<=   '+''''+formatdatetime('yyyy-mm-dd',now())+'''';  
            self.ADODataSet1.Active   :=false;          
            self.ADODataSet1.CommandText:=str;  
            self.ADODataSet1.Active   :=true;?  
          self.ADODataSet1.RecordCount   ;?  
      end;  
          str:='   select   *   from   memberinfo   ';  
          str:=str+   '   where   datetime<=   '+''''+formatdatetime('yyyy-mm-dd',now())+'''';  
          self.ADODataSet1.Active   :=false;  
          self.ADODataSet1.CommandText:=str;  
          self.ADODataSet1.Active   :=true;  
  end;  
  procedure   TForm13.FormCreate(Sender:   TObject);  
  var  
        str:string;  
  begin  
        str:='   select   *   from   memberinfo   ';  
        str:=str+   '   where   datetime<=   '+''''+formatdatetime('yyyy-mm-dd',now())+'''';  
        str:='   select   id   as   会员编号,name   as   姓名   ,sex   as   性别,tdl   as   住址,   workdw   as   工作单位,phone   as   联系电话,member   as   会员类别,datetime   as   到期日期,borrownum   as   已借册数,book   as   允许借书   from   memberinfo   ';  
        self.ADODataSet1.Active   :=false;  
        self.ADODataSet1.CommandText:=str;  
        self.ADODataSet1.Active   :=true;  
        self.ADODataSet1.RecordCount   ;  
  end;  
   
  procedure   TForm13.FormClose(Sender:   TObject;   var   Action:   TCloseAction);  
  begin  
      //   form1.Visible:=true;  
  end;  
   
  end.

查看回复