I have the following code to execute a sql stored procedure that returns multiple result sets and then reads this result from a stream. For reference: it returns xml blocks as strings, and then converts them to full xml. It has been working for more than a year, but now I have a case that leads to an error message: the operation was canceled. The debugger shows: Project x raised an EOleException exception class with the message Operation canceled. I have no idea what causes this. Any help or suggestions would be great.
const
adExecuteStream = $00000400;
var
objCmd, InputStream, XML, XSLT, Template, Processor, objConn, strmResults : Variant;
ATStreamClass : TMemoryStream;
Adapt : TStreamAdapter;
OutputStream: IStream;
objCmd := CreateOLEObject('ADODB.Command');
objCmd.ActiveConnection := dmABaasMock.dbRaAndm.ConnectionObject;
objCmd.CommandType := adCmdText;
objCmd.CommandText := <sp proc name with params>;
strmResults := CreateOLEObject('ADODB.Stream');
strmResults.Open;
objCmd.Properties['Output Stream'] := strmResults;
objCmd.Execute(EmptyParam, EmptyParam, adExecuteStream);
strmResults.Position := 0;
xmlMemo.text := strmResults.ReadText;
Tamm source
share