Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return raiserror value from stored proc in ODBC Sybase

Status
Not open for further replies.

Rana1

Programmer
Jul 7, 2000
1
GB
Hi,<br><br>I'm using ODBC to talk to a Sybase database.&nbsp;&nbsp;We <br>have the following stored procedure:<br><br>create proc testproc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@mode&nbsp;&nbsp;&nbsp;char(1) )<br>as<br>SET NOCOUNT ON<br>if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@mode&nbsp;&nbsp;&nbsp;= &quot;R&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;&nbsp;20001<br>else<br>begin<br> if&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@mode&nbsp;&nbsp;&nbsp;= &quot;P&quot;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &quot;20001 printed&quot;<br> else<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raiserror 20001 &quot;20001 error raised&quot;<br>end<br>go<br><br>If I call it from ODBC (ASP page) with &quot;E&quot; then the <br>connection.errors construct is empty.&nbsp;&nbsp;Same with &quot;R&quot;.&nbsp;&nbsp;<br>The only time I can get something into that construct <br>is by calling it with &quot;P&quot;, so it does a SQL print.<br>Surely this is wrong?&nbsp;&nbsp;I really need to be able to <br>trap raiserrors in my code, and also trap return <br>values.&nbsp;&nbsp;Possibly the second of these is the most <br>important.<br><br>Anyone seen this before?&nbsp;&nbsp;I've tried the Intersolv <br>ODBC instead with no luck either.&nbsp;&nbsp;The NOCOUNT option <br>was a possible fix on MSDN that didn't work.<br><br>Something tells me I am overlooking the obvious - would <br>one of you kind folks please enlighten me?<br><br>Thanks,<br><br>Bhoupinder Rana<br><br>Sybase 11.5.1 on Sun Solaris (SPARC) 2.6.1<br>ODBC MERANT 3.6 for Sybase ASE on NT4SP5<br>ASP on IIS4<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top