An error occurred when FDMemtable loadfromfile with master/detail relationship

0

In delphi 10.2,when I use this code:

    GetDatafromServer(spGetMDTemp, fdsaMasterDetailTemp);
    mtMasterTemp.SaveToFile(fullfilename('MasterTemp.tab'));
    mtDetailTemp.SaveToFile(fullfilename('DetailTemp.tab'));

    LoadFromfile(mttest, 'MasterTemp.tab')) ;

I found the stucture of  the mtMasterTemp and mttest is pretty diffrent. the stucture of the mtMasterTemp is correct,but the stucture of mttest is the same to mtDetailTemp! why?

procedure TPadDM.GetDatafromServer(spTarget: TFDStoredProc;
  saTarget: TFDSchemaAdapter);
var
  LstringStream: TStringStream;
begin
  spTarget.ExecProc;
  LstringStream := TStringStream.Create(spTarget.Params[0].AsBlob);
  try
    if (LstringStream <> nil) then
    begin
      LstringStream.Position := 0;
      saTarget.LoadFromStream(LstringStream, TFDStorageFormat.sfBinary);
    end;
  finally
    LstringStream.Free;
  end;
end;

function TPadDM.LoadFromfile(mtTarget: TFDMemTable; filename: string): boolean;
begin
  result := true;
  if FileExists(fullfilename(filename)) then
    mtTarget.LoadFromfile(fullfilename(filename))
  else
    result := false;
end;

Responses (0)
  • There are no replies here yet.
Your Reply

Please login to post a reply