No, I understood the real issue. I am very familiar with the TDS protocol
and its issues. However, Morton (not the original author) said that he
couldn't figure how to get return values from stored procedures. That's all
I was commenting on. Resorting to RAISERROR for everything introduces a lot
of the same problems as resorting to exceptions for everything in
object-oriented languages. Learning how and when to use stored procedure
return values (and/or output parameters) instead of RAISERROR can help you
to become a better SQL Server programmer.

The problem with your last statement is that you are treating the return
value as only a fatal indicator. Think of it as a return value. I have lots
of cases where I want to return one or more scalar values in addition to the
result set. These are all return values (and/or output parameters) that are
something other than fatal indicators. I use the return values (and/or
output parameters) to assist in further processing the result set.

-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill
Sent: Friday, February 20, 2004 3:41 PM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Stor proc return values and DataReader

I believe you missed the real issue (really described only in the very first
message in the thread [which hasn't been repeated], and replicated in the
last message at the bottom).  It's not that anyone is having trouble
"figur[ing] out how to use" SP return values -- the problem is that you
can't get the value of any OUTPUT parameters, or the SP return code, until
after the network has transmitted (and the client machine has swallowed) all
the data describing all result sets.

Using RAISERROR apparently interrupts the "here are the result sets" part of
the data stream sent to the client -- at least, that's what people are
thinking.  The example at the very bottom shows the annoyance of not being
able to see the SP return code until the entire "select name from author"
result set has been returned.

I haven't encountered in my work any SP which generated a result set and
then figured out it wanted to return a failure indication (and the app
didn't want to see the result set due to whatever the failure was), but if
that's what you need to do....

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to