procedure TForm1.ADOQuery1AfterPost(DataSet: TDataSet);
begin
  { 判断 }
end;

解决方案 »

  1.   

    大概意思:
    procedure TForm1.ADOQuery1AfterPost(DataSet: TDataSet);
    begin
     adoq1.close;
     adoq1.sql.clear;
     adoq1.sql.add('select name from tab1 where name like '
               +#39+ADOQuery1.fieldbyname'name'+#39);
     adoq1.open;
     with adoq1.fields[0] do
      begin
        if (not is null) or (asstring<>'') then
        begin
         adoq1.close;
         abort;
         exit;
        end;
      end;
    end;
      

  2.   

    你每次用户在输入的时候,自动调用一个函数来判断跟前面的输入有没有重复,在OnEdit里面调用这个过程就是了
      

  3.   

    procedure TForm1.Table1AfterPost(DataSet: TDataSet);
    const
      cKeyField = 'filed1';
    var
      vBook: string;
      B: Boolean;
      S: string;
    begin
      vBook := DataSet.Book;
      S := DataSet.FieldByName(cKeyField).AsString;
      DataSet.Filter := cKeyField + '=' + QuotedStr(S);
      DataSet.FindFirst;
      repeat
        B := vBook <> DataSet.Book;
      until B or (not DataSet.FindNext);
      DataSet.First;
      DataSet.Book := vBook;
      if B then begin
        ShowMessage('重复,需要时间不是你给的分少');
        DataSet.Delete;
      end;
    end;
      

  4.   

    const
      cKeyField = '姓名';
    //            ~~~~~~~
      

  5.   

    to andyting(安帝):你试我的没有
      

  6.   

    其实要看你打算在什么地方做拦截,如果你允许用户把一条记录保存时才判断的话,那在onbeforepost事件中可以处理;否则,在dbgrid的oncolexit事件处理。
    处理的方法就是使用一个query,在上述的事件中处理:begin
    adoq1.close;
    adoq1.sql.clear;
    adoq1.sql.add('select name from tab1 where name like '+#39+ADOQuery1.fieldbyname'name'+#39);
    adoq1.open;
    if adoq1.recordcount <> 0 then
    begin
      showmessage('记录已经存在!');
      abort;
    end;其实看你的要求怎么样,我觉得没有必要对每个字段都做这种的检查
      

  7.   

    ?//
    不会吧!!
    这是delphi!!
      

  8.   

    PB中也有D高手呀
    不是吗?
      

  9.   

    PB中也有D高手呀
    不是吗?
      

  10.   

    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?如果出错把代码给我看看
      

  11.   

    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?
    to andyting(安帝):你试我的方法没有?如果出错把代码给我看看