Stored procedure and output parameter

gfard

Member
Joined
Apr 9, 2003
Messages
11
Hi

i want to get value from my sql 2000 database from my vb.net program. these is my code

Dim sp As String = "Donor_GetUniqueID"
Dim lngID As Long

Dim arParams() As SqlParameter

arParams = SqlHelperParameterCache.GetSpParameterSet(g_strConnection, sp)


SqlHelper.ExecuteNonQuery(g_strConnection, CommandType.StoredProcedure, sp, arParams)

MessageBox.Show(arParams(0).Value.ToString())


intDon_Unique = CInt(arParamsDon(0).ToString)

I have functionality of GetSpParameterSet.
and this is my stored procedure


CREATE PROCEDURE dbo.Donor_GetUniqueID
@Don_Unique bigint output
AS

Declare @MyID bigint

SELECT @MyID=MAX(ID) FROM TDonor

SELECT @Don_Unique=Don_Unique FROM TDonor WHERE ID=@MyID
GO

but I got error over arParams = SqlHelperParameterCache.GetSpParameterSet(g_strConnection, sp) line.

anybody has this problem?

thanx
 
I would try the "ordinary" way, create a parameter and add it to the commandobjects parameterlist.
Here you can define the direction of the parameter explicitely well and it works all the time.
 
Back
Top