473,396 Members | 2,009 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,396 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 1723
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.