TQMsgPack序列还原clientdataset.data

序列

procedure TForm1.Button2Click(Sender: TObject);
var
msgpack: TQMsgPack;
begin
msgpack := TQMsgPack.Create;
try
msgpack.AsVariant := cds.Data;
if SaveDialog1.Execute then
begin
msgpack.SaveToFile(SaveDialog1.FileName);
end;
finally
FreeAndNil(msgpack);
end;
end;

还原

procedure TForm1.Button3Click(Sender: TObject);
var
msgpack: TQMsgPack;
begin
msgpack := TQMsgPack.Create;
try
if OpenDialog1.Execute() then
begin
msgpack.LoadFromFile(OpenDialog1.FileName);
cds.Close;
cds.Data := msgpack.AsVariant;
end;
finally
FreeAndNil(msgpack);
end;
end;

你可能感兴趣的:(client)