Error with multiple statements and exception returns result instead exception

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dupe
Posts: 21
Joined: Wed 15 Jun 2016 13:37

Error with multiple statements and exception returns result instead exception

Post by dupe » Wed 22 Mar 2017 19:20

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

dupe
Posts: 21
Joined: Wed 15 Jun 2016 13:37

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

Post by dupe » Thu 23 Mar 2017 15:10

I've found the mistake i made.
I have to open all result sets.

Code: Select all

query.Open;
while query.OpenNext do ;

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

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

Post by azyk » Mon 27 Mar 2017 08:45

Glad to see you have found the reason of the problem. If any other questions come up, please contact us.

Post Reply