473,320 Members | 1,876 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,320 software developers and data experts.

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(LCDBConnect.ConnectionString)
Dim dbCmd As New SqlCommand
Dim da As New SqlDataAdapter(dbCmd)

dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Connection = dbConn
dbCmd.CommandText = "spRenTempTable"
dbCmd.Parameters.Add("@MyTable", SqlDbType.VarChar)

dbCmd.Parameters("@MyTable").Direction =
ParameterDirection.Output
Try
dbConn.Open()
dbCmd.ExecuteNonQuery()
MessageBox.Show("Return Value : " &
dbCmd.Parameters("@MyTable").Value)
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 2473
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*********@yahoo.com> wrote in message
news:b6*************************@posting.google.co m...
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(LCDBConnect.ConnectionString)
Dim dbCmd As New SqlCommand
Dim da As New SqlDataAdapter(dbCmd)

dbCmd.CommandType = CommandType.StoredProcedure
dbCmd.Connection = dbConn
dbCmd.CommandText = "spRenTempTable"
dbCmd.Parameters.Add("@MyTable", SqlDbType.VarChar)

dbCmd.Parameters("@MyTable").Direction =
ParameterDirection.Output
Try
dbConn.Open()
dbCmd.ExecuteNonQuery()
MessageBox.Show("Return Value : " &
dbCmd.Parameters("@MyTable").Value)
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
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...
5
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...
8
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
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
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...
0
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...
0
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...
2
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...
0
by: Sudarsana | last post by:
How to retrieve output parameter value in ASp from Stored Procedure
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.