473,714 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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. Im 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 1754
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.co m.br> wrote in message
news:Oz******** *****@TK2MSFTNG P12.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. Im 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 ParameterDirect ion.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.co m.br> wrote in message
news:Oz******** *****@TK2MSFTNG P12.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. Im 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**********@n ews3.tilbu1.nb. home.nl>,
ne********@NeOt ammiSnPgAaM.nl says...
Hi,

IIRC, you can add a parameter with ParameterDirect ion.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***@newsgrou ps.nospam> wrote in message
news:eU******** ******@TK2MSFTN GP10.phx.gbl...
In article <ce**********@n ews3.tilbu1.nb. home.nl>,
ne********@NeOt ammiSnPgAaM.nl says...
Hi,

IIRC, you can add a parameter with ParameterDirect ion.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
22697
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 inside a sproc. Now if try to write the stored proc directly inside a fuction ie copy paste after changing my temp tables to tables the problem is , i get a error invalid use of getdate in sproc.What do i do to get something for my results inside...
1
6132
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 procedure in SQL Server with a input parameter (to select the right hardware e.g. PC for a computer, CD for cdrom, etc) and the last code would I have become with a return parameter. But when I execute my program I get an exception : Parameter 1:...
4
441
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 procedure and retrieve that value returned. Im using command. Is that possible? How can i do it? Or i must to
14
3892
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 "<stdin>", line 1, in ? File "<stdin>", line 2, in foo
1
7858
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 @fname varchar(30) declare @fsizes nvarchar BEGIN
8
11261
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 using this method with store procs that dont return a value back to Access. Hope this makes sense. Set Cmd = New Command With Cmd Set .ActiveConnection = get_XE_Conn 'makes a connection Oracle XE
1
1340
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 correctly as it gives me the Error(10,6): PLS-00103: Encountered the symbol "CREATE" .. Can you create a user in a function? The procedure reads acct names and passwords from a table, then while its not at the end it creates a user. (calls a...
0
1574
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
3115
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 it performs some logic on the row and inserts the output data into a temp table. The only point of the insert is so that I can select the data in a RETURN statement at the end of the UDF. In Firebird we could put these results directly into...
0
8711
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9314
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9075
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9017
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5948
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4464
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.