Page 1 of 1

Error with multiple statements and exception returns result instead exception

Posted: Wed 22 Mar 2017 19:20
by dupe
Hello.

We have a TMSQuery with multiple resultsets turned on.
Now we got a query like this:

SELECT 1;
SELECT 2;
THROW 50000, ‚Error‘, 1;

The query returns the SELECT 1, but we expect an exception.
If we only have the „SELECT 1“ without „SELECT 2“ it will return nothing, because oft the exception.

Can you give us an advice?

Best regards

Re: Error with multiple statements and exception returns result instead exception

Posted: Thu 23 Mar 2017 15:10
by dupe
I've found the mistake i made.
I have to open all result sets.

Code: Select all

query.Open;
while query.OpenNext do ;

Re: Error with multiple statements and exception returns result instead exception

Posted: Mon 27 Mar 2017 08:45
by azyk
Glad to see you have found the reason of the problem. If any other questions come up, please contact us.