I am calling a stored procedure with an XML output parameter in sql server and it seems to run but then I get the error message below.
"---------------------------
Debugger Exception Notification
Project PrismAPIDev.exe raised exception class EMSSQLNativeException with message '[FireDAC][Phys][ODBC][sqlncli11.dll] SQL_PARAM_DATA_AVAILABLE'.
Break Continue Help
"
When I close the application, I get this error. (possibly when closing the connection):
Debugger Exception Notification
Project PrismAPIDev.exe raised exception class EMSSQLNativeException with message '[FireDAC][Phys][ODBC][Microsoft][ODBC Driver Manager] Function sequence error'.
Break Continue Help
Here is the stored procedure code, the relevant form dfm parts as text, the code that executes the proc, and the place in the firedac code where the error is raised.
ALTER procedure [api].[sp_getApiEventChanges]
@ApiId uniqueidentifier,
@InstanceId uniqueidentifier,
@SinceEventId bigint = 0,
@Changes xml output
as
begin
set nocount on;
declare @sql nvarchar(max);
declare @ParamDef nvarchar(max) = '@InstanceId uniqueidentifier, @SinceEventId bigint, @Changes xml out';
select
@sql = NewEvents
from
api.ApiLoad
where
ApiId = @ApiId;
exec sp_executesql @sql, @ParamDef,
@InstanceId = @InstanceId,
@SinceEventId = @SinceEventId,
@Changes = @Changes out
;
return 0;
end;
object FDConnection1: TFDConnection
Params.Strings = (
'SERVER=(local)'
'OSAuthent=Yes'
'ApplicationName=PrismAPIDev'
'DATABASE=RADIS_PRISMHR'
'MARS=yes'
'DriverID=MSSQL')
FetchOptions.AssignedValues = [evLiveWindowFastFirst]
FetchOptions.LiveWindowFastFirst = True
ResourceOptions.AssignedValues = [rvServerOutput, rvAutoReconnect]
ResourceOptions.ServerOutput = True
ResourceOptions.AutoReconnect = True
Connected = True
LoginPrompt = False
Left = 312
Top = 267
end
object FDStoredProc1: TFDStoredProc
Connection = FDConnection1
ResourceOptions.AssignedValues = [rvDirectExecute]
ResourceOptions.DirectExecute = True
StoredProcName = 'RADIS_PRISMHR.api.sp_getApiEventChanges'
Left = 424
Top = 355
ParamData = <
item
Position = 1
Name = '@RETURN_VALUE'
DataType = ftInteger
ParamType = ptResult
Value = 0
end
item
Position = 2
Name = '@ApiId'
DataType = ftGuid
ParamType = ptInput
Size = 38
Value = '{d8025765-e109-4180-9491-8f7407ef035c}'
end
item
Position = 3
Name = '@InstanceId'
DataType = ftGuid
ParamType = ptInput
Size = 38
Value = '{8E1193B3-E089-46BA-B9A3-270F675EAF29}'
end
item
Position = 4
Name = '@SinceEventId'
DataType = ftLargeint
ParamType = ptInput
Value = '0'
end
item
Position = 5
Name = '@Changes'
DataType = ftDBaseOle
FDDataType = dtXML
ParamType = ptInputOutput
end>
end
procedure TForm19.dxBarLargeButton1Click(Sender: TObject);
begin
FDStoredProc1.ExecProc;
end;
{-------------------------------------------------------------------------------}
procedure FDException(AObj: TObject; AEx: EFDException
{$IFDEF FireDAC_Monitor}; ATracing: Boolean {$ENDIF});
var
oHndlr: IFDStanErrorHandler;
oMAIntf: IFDMoniAdapter;
oEx: Exception;
oObj: IFDStanObject;
begin
if (AEx is EFDDBEngineException) and
Supports(AObj, IFDMoniAdapter, oMAIntf) and
(oMAIntf.SupportItems * [ikSQL, ikParam] = [ikSQL, ikParam]) then
EFDDBEngineException(AEx).SetSQLAndParams(oMAIntf);
if Supports(AObj, IFDStanObject, oObj) then
AEx.SetFDObjectName(oObj);
oEx := Exception(AEx);
if Supports(AObj, IFDStanErrorHandler, oHndlr) then
try
oHndlr.HandleException(oObj, oEx);
except
on E: Exception do begin
if (E <> oEx) and (oEx <> nil) then
FDFree(oEx);
raise;
end;
end;
if oEx <> nil then begin
{$IFDEF FireDAC_Monitor}
// The monitor client messages queue may be not empty. When an exception
// is raised and an IDE is stopped, the queue remains not empty and
// FDMonitor does not show error message. So, give the CPU to other threads.
if ATracing then
Sleep(50);
{$ENDIF}
raise oEx; <---- ERROR RAISED HERE
end;
end;
Connect with Us