如题,代码如下:  if not (Aqrystmgcountdetail.State = dsInsert) or (Aqrystmgcountdetail.State = dsEdit) then
  begin
    if not Aqrystmgcountdetail.IsEmpty then
      if DBGridEh3.SelectedRows.Count >= 1 then
      begin
        if Application.MessageBox(' 你是否要删除?', '选择', MB_YESNO) = IDYES then
        begin
          DelStr := Aqrystmgcountdetail.fieldbyname('code').AsString;
          // Aqrystmgcountdetail.Delete;
          DBGridEh3.SelectedRows.Delete;
          Aqrystmgcountdetail.UpdateBatch();
        end;
        Aqrystmgcountdetail.Refresh;
      end;
  end
  else
  begin
    Application.MessageBox('请查看是否选中记录', '系统提示', mb_ok + mb_iconwarning);
    exit;
  end;
  with Aqrystmgcountdetail do
  begin
    Close;
    sql.clear;
    sql.Add('select * from st_mg_count_detail  where code=:code and dept=''' + trim(CmbTotalDept.Text) + '''');
    sql.Add('order by process_no');
    Parameters.FindParam('code').DataType := ftInteger;
    Open;
    Refresh;
  end;
高手们帮忙看下,怎么解决???在线等

解决方案 »

  1.   

    在执行完这个操作后,执行了Aqrystmgcountdetail的afterdelete事件,代码如下,但是不是在这里出的错,而是执行完这里的代码后报的错  Aqrystmgcountdetail.Close;
      Aqrystmgcountdetail.sql.Text := 'select * from st_mg_count_detail  where code=' + '''' + DelStr + '''' + ' and dept=''' + trim(CmbTotalDept.Text) + ''' order by process_no';
      Aqrystmgcountdetail.Open;