[thelist] SQL Server/ADO: Problems Getting a Return Value

MRC webmaster at equilon-mrc.com
Wed Dec 19 12:45:52 CST 2001


SQL Server/ADO Gurus:

    Often when I create stored procedures, I have them return the value of
@@ERROR to determine in my application (typically an ASP page) whether an
error has occurred in the stored procedure. The documentation on return
values is a bit sparse, but I've found that I can grab the return value from
the parameters collection when I simply execute the command object without
returning a recordset.
    However, when I create a recordset object and set the value of that
object to be the result of the command object's execute method (e.g., Set
objRs = objCmd.Execute), I can't get a return value -- it doesn't seem to
exist, even if I set it explicitly in the stored procedure.
    Is this expected behavior, or am I missing something? Does the cursor
type dictate this behavior? I guess I could plunk the value into the
recordset and return it that way, but that seems inelegant. Any wisdom?

James Aylard







More information about the thelist mailing list