Page 1 of 1

TMSStoredProc bug?

Posted: Fri 30 Mar 2007 00:32
by Frenk3
If I execute a procedure via TMSStoredProc and error on update is reported (Level16) TMSStoredProc doesn't generate exception. If I run the same procedure using Conn.CreateSQL::Execute, exception is generated properly. Any idea why?
Using D7, SDAC 3.80.0.84STD

Regards,
Frenk

Posted: Mon 02 Apr 2007 10:51
by Jackson
Your stored procedure 'sp_AddNarP' returns multiple result sets.
During execution of this stored procedure from your example an error occurs,
but after the first result set successfully generated and passed to the
client side.
The TMSStoredProc component receives the result set and doesn't request
subsequent results from server (as the user should process the first
received result set), that's why it knows nothing about the error. To get
next results of query execution you should use the TCustomMSDataSet.OpenNext
method.
After the call of the TCustomMSDataSet.OpenNext method the TMSStoredProc
component will receive the information about the error occurred and generate
an exception.
When you call the TMSConnection.ExecSQL method, it uses internally created
TMSSQL component.
TMSSQL component doesn't request result sets, that's why it gets error
information immediately after execution and generates exception.
So, if you want your TMSStoredProc component to generate an exception, place
the following code after the call of the TMSStoredProc.Execute method:
while OpenNext do;