检查tem.db表中有无a5,a6字段好办with Query1 do
begin
  Close;
  SQL.Clear;
  SQL.Add('select * from tem.db where 1=0'); // 只是获得字段,不想得到记录.故用1=0
  Open;
  // 以下检查字段是否存在
  for iLoop:=0 to FieldCount-1 do
  begin
    if (Fields[iPos].FieldName = 'a5') or (Fields[iPos].FieldName = 'a6') then
    begin
      iLoop := -1;  // 字段重复标志
      break;
    end;
  end;
  Close;
end;if iLoop<>-1 then  //以下可添加字段a5,a6
begin
...........
end;