function TDtmRemoteRes.GetRemoteRes(AClntDts: TClientDataSet): Boolean;
var
vDts: OleVariant;
sSql: WideString;
sF: string;
begin
CoInitialize(nil);
try
Result := False;
try
sF := ExtractFilePath(GetModuleName(HInstance)) + 'Data/Resource.dat';
if not DirectoryExists(ExtractFileDir(sF)) then
ForceDirectories(ExtractFileDir(sF));
try
sSql := 'Select * From TblTest ';
GetRemoteData.OpenDataSet(sSql, vDts);
AClntDts.Data := vDts;
AClntDts.SaveToFile(sF);
CnDebugger.TraceMsg('从服务器上取到资源数据.');
Result := True;
except
if not SvrActive then
if FileExists(sF) then
begin
AClntDts.LoadFromFile(sF);
Result := True;
end else
Result := False;
end;
except
Result := False;
end;
finally
cnnRemoteRes.Close;
CoUninitialize;
end;
end;
之后你就可以对ClientDataSet进行操作.修改后的数据重新保存到本地文件