473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Function Return inside Store Procedure

Hi all, i have a store procedure that i use the return function . Ex.
create procedute XX as
(statement...)
if @@error <> 0
return 1
else
return 0 .

Inside the vb net i wnat to call that procedure and retrieve that value
returned. I´m using command. Is that possible? How can i do it? Or i must to
create an output variable in my sp?
Thanks
Jul 21 '05 #1
4 1721
Daniel,

You could use an Output variable, or use RAISERROR keyword within Stored
Procedure along with a custom error (see sp_addmessage in Books Online) and
catch the error in your application (see ADODB.Errors Collection).

Cheers,
Neil

"Daniel Caetano" <dc******@ig.com.br> wrote in message
news:Oz*************@TK2MSFTNGP12.phx.gbl...
Hi all, i have a store procedure that i use the return function . Ex.
create procedute XX as
(statement...)
if @@error <> 0
return 1
else
return 0 .

Inside the vb net i wnat to call that procedure and retrieve that value
returned. I´m using command. Is that possible? How can i do it? Or i must to create an output variable in my sp?
Thanks

Jul 21 '05 #2
Hi,

IIRC, you can add a parameter with ParameterDirection.Return to the command
that's calling the storedprocedure. Retrieving the return value can then be
done by reading the value of the passed parameter.

Erik

"Daniel Caetano" <dc******@ig.com.br> wrote in message
news:Oz*************@TK2MSFTNGP12.phx.gbl...
Hi all, i have a store procedure that i use the return function . Ex.
create procedute XX as
(statement...)
if @@error <> 0
return 1
else
return 0 .

Inside the vb net i wnat to call that procedure and retrieve that value
returned. I´m using command. Is that possible? How can i do it? Or i must to create an output variable in my sp?
Thanks

Jul 21 '05 #3
In article <ce**********@news3.tilbu1.nb.home.nl>,
ne********@NeOtammiSnPgAaM.nl says...
Hi,

IIRC, you can add a parameter with ParameterDirection.Return to the command
that's calling the storedprocedure. Retrieving the return value can then be
done by reading the value of the passed parameter.

Erik

Hi,
and do you know a way to get the output of the PRINT statements from the
SP?

Thanks
Sunny
Jul 21 '05 #4
Hi,

Capturing the output from print statements will be somewhat more difficult.
IIRC ADO had a special collection that contains these messages in its
command object. Can't find (or overlooked) that same functionality in .NET.
As the output gets to stdout when you call the sp from the console, you
might want to try to redirect standard output to a stream and read the
results from there.
You'll have to do some more digging work on this !

Erik

"Sunny" <su***@newsgroups.nospam> wrote in message
news:eU**************@TK2MSFTNGP10.phx.gbl...
In article <ce**********@news3.tilbu1.nb.home.nl>,
ne********@NeOtammiSnPgAaM.nl says...
Hi,

IIRC, you can add a parameter with ParameterDirection.Return to the command that's calling the storedprocedure. Retrieving the return value can then be done by reading the value of the passed parameter.

Erik

Hi,
and do you know a way to get the output of the PRINT statements from the
SP?

Thanks
Sunny

Jul 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rajesh Garg | last post by:
Hi, I have written a stored proc with some temporary tables and also used a getdate() in my stored proc. When i try to call the sproc the error is that we can only use extended sprocs or function...
1
by: Hugo Lefevre | last post by:
Dear, I have a problem : I have a database which contains my data of hardware. The Id is a varchar and I want at my filling form that my user know which is the last one. So I made a store...
4
by: Daniel Caetano | last post by:
Hi all, i have a store procedure that i use the return function . Ex. create procedute XX as (statement...) if @@error <> 0 return 1 else return 0 . Inside the vb net i wnat to call that...
14
by: James Thiele | last post by:
I'd like to access the name of a function from inside the function. My first idea didn't work. >>> def foo(): .... print func_name .... >>> foo() Traceback (most recent call last): File...
1
by: eRTIS SQL | last post by:
hi, I want to use a stored procedure inside a stored procedure simulteanously changing the database. this is my base store procedure alter PROCEDURE create_file @dbname sysname AS declare...
8
by: colmkav | last post by:
Can someone tell me how I can access the return value of a function called from Oracle as opposed to a store proc from oracle? my oracle function is get_num_dates_varposfile. I am only used to...
1
by: brig | last post by:
Hi, I am new to sql, so I apologize in advance. I wrote a procedure which calls a function. (I am not sure if the procedure will work yet). MY question is on the function. I am not sure I wrote it...
0
by: ponvijaya | last post by:
Hi all, I have used a substring function inside my stored procedre as set @dummy1=substring(@dummyid,2); but when i print and check the value of @dummy1 as select @dummy1;
0
by: davidsavill | last post by:
Hi All, I am migrating a database from Firebird/Interbase to DB2 and have having issues with the stored procedures/functions. I have a number of functions that loop over a FOR loop, each pass...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.