т.е. этот код работает ок:
var
storedProc: TADOStoredProc;
XmlSessions: TStream;
i: Integer;
begin
storedProc := TADOStoredProc.Create(nil);
try
with storedProc do
begin
Connection := FConnection;
ProcedureName := 'we_OrgUnits_GetOrgUnitsSessionSums';
with Parameters.AddParameter do
begin
Name := '@ParentId';
DataType := ftInteger;
Value := AParentId;
end;
with Parameters.AddParameter do
begin
Name := '@XMLSessions';
DataType := ftMemo;
XmlSessions := TMemoryStream.Create;
try
GetXmlStream(ASessions, 'ComputerName', 'UserName', XmlSessions);
LoadFromStream(XmlSessions, ftMemo);
finally
XmlSessions.Free;
end;
end;
with Parameters.AddParameter do
begin
Name := '@LoginId';
DataType := ftInteger;
Value := 0;
if (ALogin <> nil) and not ALogin.IsAdmin then
Value := ALogin.Id;
end;
Open;
try
if RecordCount > 0 then
begin
First;
while not Eof do
begin
ASums.Add(Fields[0].AsString + '=' + Fields[1].AsString);
Next;
end;
end;
finally
Close;
end;
end;
finally
storedProc.Free;
end;
а этот возвращает пустые строки:
var
storedProc: TADOStoredProc;
XmlSessions: TStream;
i: Integer;
begin
storedProc := TADOStoredProc.Create(nil);
try
with storedProc do
begin
Connection := FConnection;
ProcedureName := 'we_OrgUnits_GetOrgUnitsSessionSums';
with Parameters.AddParameter do
begin
Name := '@ParentId';
DataType := ftInteger;
Value := AParentId;
end;
with Parameters.AddParameter do
begin
Name := '@XMLSessions';
DataType := ftMemo;
XmlSessions := TMemoryStream.Create;
try
GetXmlStream(ASessions, 'ComputerName', 'UserName', XmlSessions);
LoadFromStream(XmlSessions, ftMemo);
finally
XmlSessions.Free;
end;
end;
with Parameters.AddParameter do
begin
Name := '@LoginId';
DataType := ftInteger;
Value := 0;
if (ALogin <> nil) and not ALogin.IsAdmin then
Value := ALogin.Id;
end;
Open;
try
if RecordCount > 0 then
begin
RecordSet.MoveFirst;
while not RecordSet.Eof do
begin
ASums.Add(RecordSet.Fields[0].Value + '=' + RecordSet.Fields[1].Value);
RecordSet.MoveNext;
end;
end;
finally
Close;
end;
end;
finally
storedProc.Free;
end;