StoredProc Firemonkey Exception Handling
Posted: Sun 15 Mar 2015 22:56
Hi,
I am creating a TUniStoredProc object on the fly.
I can execute it via ExecProc method. The storedproc contains some rules for input parameter values.
I sent incorrect parameter values to storedproc, it executed successfully without any exception also i could not handle exception. It did not return any exception.
What is the problem?
My Sql Server: 2012 Standart Edition
Component Version: 6.0.2
Android Ver: 4.2.2
IDE: Delphi XE7
Mode: Direct Mode
Stored Proc contains raise message:
-----------------------------------------------
Raiserror('Test-Brake Message',16,1);
return;
--------------------------------------------------
Thanks
Example:
--------------
try
with TUniStoredProc.Create(nil) do
begin
try
Connection := DataM.SDB;
StoredProcName := 'spSampleProc';
Prepare;
Params.ParamByName('param1').AsInteger := 1;
Params.ParamByName('param2').AsString := '1';
Params.ParamByName('param3').asFloat := 0;
Params.ParamByName('param4').Asstring := 'test';
ExecProc;
finally
Free;
end;
except on E:exception do
begin
ExceptionLog('Exception:'+E.Message);
end;
---------------------------------------
end;
I am creating a TUniStoredProc object on the fly.
I can execute it via ExecProc method. The storedproc contains some rules for input parameter values.
I sent incorrect parameter values to storedproc, it executed successfully without any exception also i could not handle exception. It did not return any exception.
What is the problem?
My Sql Server: 2012 Standart Edition
Component Version: 6.0.2
Android Ver: 4.2.2
IDE: Delphi XE7
Mode: Direct Mode
Stored Proc contains raise message:
-----------------------------------------------
Raiserror('Test-Brake Message',16,1);
return;
--------------------------------------------------
Thanks
Example:
--------------
try
with TUniStoredProc.Create(nil) do
begin
try
Connection := DataM.SDB;
StoredProcName := 'spSampleProc';
Prepare;
Params.ParamByName('param1').AsInteger := 1;
Params.ParamByName('param2').AsString := '1';
Params.ParamByName('param3').asFloat := 0;
Params.ParamByName('param4').Asstring := 'test';
ExecProc;
finally
Free;
end;
except on E:exception do
begin
ExceptionLog('Exception:'+E.Message);
end;
---------------------------------------
end;