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;
StoredProc Firemonkey Exception Handling
Re: StoredProc Firemonkey Exception Handling
Unfortunately, we can't reproduce the described problem. Please provide the script for creating the spSampleProc stored procedure, which reproduces the issue.
-
- Posts: 15
- Joined: Thu 21 Apr 2005 22:02
Re: StoredProc Firemonkey Exception Handling
Hi Again,
Thank you for your reply.
I use same sql server stored procedure both of my desktop software and my mobile application.
My stored procedure contains :
"if (bla bla bla)
begin
raiserror('Error Condition: XXXXX',16,1);
IF @@TRANCOUNT>0
rollback tran;
return
end"
Desktop application can handle this raiserror message and creates exception.
But mobile application can not handle raiserror and does not create any exception in my mobile software code block.
Thank you for your reply.
I use same sql server stored procedure both of my desktop software and my mobile application.
My stored procedure contains :
"if (bla bla bla)
begin
raiserror('Error Condition: XXXXX',16,1);
IF @@TRANCOUNT>0
rollback tran;
return
end"
Desktop application can handle this raiserror message and creates exception.
But mobile application can not handle raiserror and does not create any exception in my mobile software code block.
Re: StoredProc Firemonkey Exception Handling
Please clarify whether an exception occurs on executing the following stored procedure on your Android device.
The stored procedure creating script:
The code for calling the stored procedure:
If an exception occurs for the above case, then the condition you have provided in the stored procedure
The stored procedure creating script:
Code: Select all
CREATE PROCEDURE spRaiserror
AS
Raiserror('Test-Brake Message',16,1);
return;
Code: Select all
try
with TUniStoredProc.Create(nil) do
try
Connection := DataM.SDB;
StoredProcName := 'spRaiserror';
Prepare;
ExecProc;
finally
Free;
end;
except
on E: exception do
begin
ExceptionLog('Exception:'+E.Message);
end;
end;
is not executed. In this case, please compose a small complete sample demonstrating the problem and send it to andreyz*devart*com . In addition, include test table and stored procedure creating scripts in the project.osmantaskiran wrote:"if (bla bla bla)