Hallo zusammen,
so funktioniert es jetzt einwandfrei. Dankeschön Uwe.
Delphi-Quellcode:
-------------------------------SERVER---------------------
function TdmDALZMI.GetBauJSONStr(BauNr:integer): String;
var
stream: TStringStream;
begin
stream := TStringStream.Create;
try
qrGetBau.Active := False;
qrGetBau.Params[0].Value := BauNr;
qrGetBau.Active := True;
qrGetBau.SaveToStream(stream, TFDStorageFormat.sfJSON);
stream.Seek(0, soFromBeginning);
qrGetBau.Active := False;
result := stream.DataString;
finally
stream.Free;
end;
end;
-------------------------------CLIENT---------------------
procedure TdmZMI.GetBauJSONStr(BauNr:integer);
var
LDataSetList: TFDJSONDataSets;
LJSONStr: String;
LZMIClient: TdmServerMethodsZMIClient;
begin
LZMIClient := TdmServerMethodsZMIClient.Create(CMClientModule.CMCSQLConnection.DBXConnection);
try
LJSONStr := LZMIClient.ZMI_GetBauJSONStr(BauNr);
JSONToDataSet(LJSONStr, mtBau);
finally
LZMIClient.Free;
end;
mtBau.Open;
end;
procedure TdmZMI.JSONToDataSet(const Source: string; Target: TFDDataSet);
var
stream: TStringStream;
begin
stream := TStringStream.Create(Source);
try
Target.LoadFromStream(stream, TFDStorageFormat.sfJSON);
finally
stream.Free;
end;
end;
Gruß Kostas