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

Get output parameter sqlclient stored procedure

Ben
Hi

I have the code below which i got from:

It only appers to return 1 from the stored procedure, where as the figure
should be 43253

Any help with a solution would be much appreciated,

Thanks
B

'Calling Function
Dim Parameters(0) As SqlParameter

Parameters(0) = New SqlParameter("@iReturn", SqlDbType.Int) :
Parameters(0).Value = 0

intCaseItem_No = SqlDataProvider.ExecuteQuery(strConnectionString,
"sp_GetClientID", CommandType.StoredProcedure, Parameters)

'Function

Public Shared Function ExecuteQuery(ByVal ConnectionString As String, ByVal
CommandText As String, ByVal CommandType As CommandType, _

ByVal CommandParameters() As SqlParameter) As Object

Dim ReturnValue As Object = Nothing

Try

SqlConn = New SqlConnection(ConnectionString)

SqlComm = New SqlCommand(CommandText, SqlConn)

SqlComm.CommandType = CommandType

Dim OutputParameter As String = SqlDataProvider.AddParameters(SqlComm,
CommandParameters)

If Not (SqlConn.State = ConnectionState.Open) Then SqlConn.Open()

ReturnValue = SqlComm.ExecuteNonQuery()

If Not (OutputParameter = String.Empty) Or OutputParameter <> "" Or
CommandType = CommandType.StoredProcedure Then

ReturnValue = SqlComm.Parameters(0).Value.ToString()

End If

Catch ex As Exception

_LastError = ex

Finally

If Not (SqlConn.State = ConnectionState.Closed) Then SqlConn.Close()

End Try

Return ReturnValue

End Function
Apr 1 '06 #1
0 1318

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

Similar topics

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
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
3
by: Hewit | last post by:
I have a stored procedure which returns records and output parameters(SQL2K). How to call this stored procedure using ADO.Net so that I can use both results in my application. I have .Net...
3
by: juststarter | last post by:
Hello all, I am executing a stored procedure (on an SQL Server) using ODBC but i can't get the output parameter's value on the client. The stored proc has 3 parameters ,2 of them are input and 1...
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...
3
by: michelle | last post by:
I am trying to get an output value from a stored procedure using sqlDataSource in asp.net 2.0. But I only get a null value for the output. Can someone please help? The sqlDataSource: ...
6
by: gurvar | last post by:
hI, i'M TRTYING TO PASS PARAMETER TO A SP.BUT GETTING "OUT OF RANGE ERROR ERROR FOLLOWING IS THE CODE: Dim conDG As SqlClient.SqlConnection Dim cmdDG As SqlClient.SqlCommand Dim drDG As...
18
by: Terry Holland | last post by:
I have an asp.net (1.1) application that connects to a SQL server 2000 db. I have a stored procedure in my db that out puts data in xml format. What I need to be able to do is display that xml...
1
by: csgraham74 | last post by:
Hi Guys, Im attempting to get an output value from my stored procedure. Im pulling my hair out at this one. any help appreciated. my code is as follows: Dim cnstring As String Dim iConn...
1
by: rogerford | last post by:
Hi, I am trying to retrieve a value from database, based on that value I want to insert records into DB.Let’s say I am retrieving tsmid which serves as the output parameter in the stored procedure....
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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,...
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,...

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.