473,776 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve Output from a stored Procedure

Hi all,

Need some help again. I am trying to retrieve an output from a Stored
Procedure...not having much luck. If anyone could steer me in the
right direction, it would be appreciated. I'm using SQL 2000 and
VB.Net

the Stored Proc is working fine. The following is just a test to
return it to the program

Dim dbConn As New SqlConnection(L CDBConnect.Conn ectionString)
Dim dbCmd As New SqlCommand
Dim da As New SqlDataAdapter( dbCmd)

dbCmd.CommandTy pe = CommandType.Sto redProcedure
dbCmd.Connectio n = dbConn
dbCmd.CommandTe xt = "spRenTempTable "
dbCmd.Parameter s.Add("@MyTable ", SqlDbType.VarCh ar)

dbCmd.Parameter s("@MyTable").D irection =
ParameterDirect ion.Output
Try
dbConn.Open()
dbCmd.ExecuteNo nQuery()
MessageBox.Show ("Return Value : " &
dbCmd.Parameter s("@MyTable").V alue)
Catch ex As Exception
MessageBox.Show (ex.ToString())
Finally
dbConn.Close()
End Try
thanks for your help
Dave McKie
11/1/2004
Nov 21 '05 #1
1 2502
Check out the at Retrieving the Gazoutas: Understanding SQL Server Return
Codes and Output Parameters
http://www.betav.com/msdn_magazine.htm

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Dave McKie" <da*********@ya hoo.com> wrote in message
news:b6******** *************** **@posting.goog le.com...
Hi all,

Need some help again. I am trying to retrieve an output from a Stored
Procedure...not having much luck. If anyone could steer me in the
right direction, it would be appreciated. I'm using SQL 2000 and
VB.Net

the Stored Proc is working fine. The following is just a test to
return it to the program

Dim dbConn As New SqlConnection(L CDBConnect.Conn ectionString)
Dim dbCmd As New SqlCommand
Dim da As New SqlDataAdapter( dbCmd)

dbCmd.CommandTy pe = CommandType.Sto redProcedure
dbCmd.Connectio n = dbConn
dbCmd.CommandTe xt = "spRenTempTable "
dbCmd.Parameter s.Add("@MyTable ", SqlDbType.VarCh ar)

dbCmd.Parameter s("@MyTable").D irection =
ParameterDirect ion.Output
Try
dbConn.Open()
dbCmd.ExecuteNo nQuery()
MessageBox.Show ("Return Value : " &
dbCmd.Parameter s("@MyTable").V alue)
Catch ex As Exception
MessageBox.Show (ex.ToString())
Finally
dbConn.Close()
End Try
thanks for your help
Dave McKie
11/1/2004

Nov 21 '05 #2

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

Similar topics

2
10391
by: Begoña | last post by:
in my java application I've made a call to this stored procedure CREATE procedure pruebaICM @pANI varchar(20), @pTABLA varchar(20), @pInsert varchar(500), @pUpdate varchar(1000), @pFLAG varchar(1), @pResultado int OUTPUT
5
23365
by: Jay Chan | last post by:
I am trying to use a command line program to run a stored procedure that generates output in a comma-delimitted format. Somehow, ISQL or OSQL always wrap the lines at 256 characters. I believe this has something to do with the column width switch (-w). But enlarging the column width to 800 characters max still doesn't help. The following is a stored procedure that is essentially doing what my stored procedure is doing: create procedure...
8
4457
by: Christopher Weaver | last post by:
I'm having trouble accessing the value of an output parameter of a stored procedure. The SP looks like this: SET TERM ^ ; CREATE PROCEDURE SP_NEW_TASK RETURNS ( "uidTask" INTEGER) AS begin
5
6521
by: MS | last post by:
Here's my simple stored procedure: ALTER PROCEDURE GetMemberIDByEmail @Email EmailAddress, @ID int OUTPUT AS SELECT @ID = ID FROM tbl_Member WHERE Email=@Email RETURN
4
50416
by: Mr Not So Know It All | last post by:
im new to SQL Server and ASP.Net. Here's my problem. I have this SQL Server stored procedure with an input parameter and output parameter CREATE PROCEDURE . @in_rc varchar(8) @out_eList varchar(7) output AS select @out_eList = ecuid from _organization where rccode = @in_rc GO
0
1276
by: r1 | last post by:
I am relatively inexperienced in using delegates and asynchronous methods. I read several articles, and then I developed my own code with a mission to improve the performance. Wow! I cannot believe the difference in speed! However, the asynch operation fails sometimes, despite of the fact that it works most of the time. I am really at a loss how to fix this sporadic and erratic behavior. This is a web application developed with...
0
19293
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a hell of a time with it... The following comes from phpinfo(): PHP Version: 5.1.2 mysql Client API version: 5.0.18 mysqli Client API version: 5.0.18
2
4375
by: feets | last post by:
OK first time poster, so hello everyone in advance. Right i'm sure this is a simple problem to solve, but I'm just getting the hang of SQL 2000. What I've got is a form where I input the values and then through a procedure these values are inserted into a table. That's fine. However I now need to open a subform which is linked by the ID field created through the first procedure. How do I retrieve that value back into the form?? The...
0
1443
by: Sudarsana | last post by:
How to retrieve output parameter value in ASp from Stored Procedure
0
9462
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
10119
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
10060
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
8951
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7469
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6721
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
5492
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3621
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2859
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.