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 (1)
  • Accepted Answer

    Monday, July 24 2017, 11:35 AM - #Permalink
    0

    Hi Fong!

    Could you provide more information what are you trying to achieve? At least what identifiers that you use in code mean?

    Paweł

    The reply is currently minimized Show
Your Reply

Please login to post a reply