all groups > vb.net upgrade > april 2007 >
You're in the

vb.net upgrade

group:

Can someone help me get this to work?


Can someone help me get this to work? jbonifacejr
4/27/2007 8:53:57 PM
vb.net upgrade:
Sorry if this angers anyone. I'm posting here and to the other groups.
I am unable to get a return value from a stored procedure in .NET
using the following Sproc and VB code in a .NET Web Project.


Here is the code in my stored proc.

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sprocRetArtistSerial]
-- Add the parameters for the stored procedure here
@sArtist varchar(50),
@sRetArtist bigint OUTPUT
AS
BEGIN
SET @sRetArtist = (SELECT artSerial FROM tblArtists WHERE artName =
@sArtist)
END


I am calling it like this....

Dim iArtSer As Integer
Dim sProc As ADODB.Command
sProc = New ADODB.Command
sProc.CommandText = "sprocRetArtistSerial"
sProc.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
sProc.ActiveConnection = oConn 'the connection is open and
global

sProc.Parameters.Append(sProc.CreateParameter("@sArtist",
ADODB.DataTypeEnum.adVarChar,
ADODB.ParameterDirectionEnum.adParamInput, 50, "Iron Maiden"))


sProc.Parameters.Append(sProc.CreateParameter("@sRetArtist",
ADODB.DataTypeEnum.adBigInt,
ADODB.ParameterDirectionEnum.adParamOutput))

sProc.Execute()
iArtSer = sProc("@sRetArtist).Value
Re: Can someone help me get this to work? Jay Parzych
4/28/2007 10:43:12 PM
[quoted text, click to view]


try sproc.Parameters("@sRetArtist").Valu

AddThis Social Bookmark Button