ADO, SQL Server 2000, stored procedure and errors

From: ADO, SQL Server 2000, stored procedure a (a_at_discussions.microsoft.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 09:23:59 -0700

I have a stored procedure in SQL Server 2000 where a piece of code is something like the following snippet (@c ia a varchar variabile)

1 set @c = 'text data'
2 if (CAST(@c as int) = -1)
3 select '@c is -1'
4
5 select 'gone on after the error'

If I execute this stored procedure with Query Analyzer what happens, as I expected, is that an error is raised (with an error level of 16) and lines 3 and 5 are not executed (I can't see the results of select statements in the results pane of Query Analyzer).
On the other end, if I execute the stored procedure with an ADO.Command object, Command.Execute method is executed reporting no errors. I can't see any error in the Connection's Errors collection too.

Is it correct ? I excpected the error reported also at client side !

Thank you very much for any help.

Luigi