function DownloadTable(RemoteDataSet, LocalDataSet: TCustomADODataSet): Boolean;<br>var<br> I, FieldCount: Integer;<br> Error: String;<br>begin<br> Result := true;<br> RemoteDataSet.First;<br> FieldCount := RemoteDataSet.FieldCount;<br> EmptyTable(LocalDataSet);<br><br> while not RemoteDataSet.Eof do begin<br> LocalDataSet.Append;<br><br> for I := 0 to FieldCount - 1 do<br> if LocalDataSet.Fields.FieldName = RemoteDataSet.Fields.FieldName then<br> LocalDataSet.Fields.AsString := RemoteDataSet.Fields.AsString<br> else begin<br> Error := Format('%s与%s字段不匹配。', [RemoteDataSet.Fields.FieldName, LocalDataSet.Fields.FieldName]);<br> Application.MessageBox(PChar(Error), '');<br> Result := false;<br> end;<br><br> LocalDataSet.Post;<br> RemoteDataSet.Next;<br> end; { end while }<br>end;