解决方案 »

  1.   

    用sql语句先去数据表中验证一下是否有该记录就行了啊。
    至于这样的函数吗,我没有见过了。
      

  2.   

    查找一下,如果找到就是存在了,呵呵!
    table.locate(好像是,既不清楚了)
      

  3.   

    IF TABLE1.LOCATE('字段名','查找内容',[]) then
    begin
      ;查到要做的事情
    end
    else
    begin
      ;查不到要做的事情
    end;
      

  4.   

    如果要查找的字段为三个时,TABLE.LOCATE()是否可以做到?
      

  5.   

    可以做到
    if table.locate('','','',arrayof('','',''),[]);
    好像是
      

  6.   

    我是这样写的:
    procedure Tfr_jjfenxi.Bnt_sxClick(Sender: TObject);
    var
    Excelapp:variant;
    I:integer;
    Year,Name,Sx:string;
    begin
    Excelapp:=CreateOleObject('Excel.Application');    //动态创建EXCEL
    Excelapp.Visible:=True;                            //执行时可见
    ExcelApp.workbooks.open(ExtractFilePath(paramstr(0))+'AAA.xls'); for i:=6 to 300 do//最大取值300
      begin
         if trim(ExcelApp.cells.item[i+1,2])<>'' then  begin
         Year:=copy(Trim(ExcelApp.cells.item[4,1]),1,7);                Name:=Trim(ExcelApp.cells.item[i+1,2]); 
         Sx:=Trim(ExcelApp.cells.item[i+1,5]);
             if not(TBL_SX.Locate('qs;name;sx',VarArrayOf([Year, Name, Sx]),[])) then
             begin
             TBL_SX.appendrecord([Year,Name,Sx]);   //如果没有相同的记录,将记录添加到数据表
             fr_jjfenxi.Refresh;
             end
         end
         else
         begin
         Excelapp.workbooks.close;   //如果表格中行为空时,退出
         Excelapp.quit;
         end
    end;
    end;
    但是,程序却不能判断数据表中已存在相同的记录,请各位指点!