Procedure ImportData(strFileName, strTableName, strKeyFieldName: string); begin with AdoDataSet1 do begin Close; LoadFromFile(strFileName); First; While not eof do begin StrKeyValue := FieldByName(strKeyFieldName).AsString; If RecordInDest(strTableName, strKeyFieldName, strKeyValue) then begin AdoDataDest.Close; AdoDataSetDest.CommandText := Format(‘select * from %s where %s=%s’,[strTableName, strKeyFieldName, QuotedStr(strKeyValue)]); AdoDataSetDest.Open; AdoDataSetDest.First; AdoDataSetDest.Edit; for I:=0 to FieldList.Count-1 do AdoDataSetDest.Fields[I] := Fields[I]; AdoDataSetDest.Post; end |