Hi I am using vs 2008 doing a winforms app in vb.net. I have a database with a single table, that has two columns, in it and a stored procedure. The stored procedure is supposed to take an input value, match that value against one column in the table and then return the corresponding value from the other column; except it doesnt.It returns 1 or 0 please can anyone tell me why
ALTER PROCEDURE dbo.getgamenumber(@outputnumber bigint OUTPUT,
@inputnumber bigint)
AS
SELECT @outputnumber = ggnumber
FROM statstable
WHERE gindex = @inputnumber
RETURN @outputnumber
and the stored proc is called thus
With cmdgetgame
.CommandType = CommandType.StoredProcedure
.CommandText = "getgamenumber"
.Parameters.Add("@outputnumber", SqlDbType.BigInt).Value = outputnumber
.Parameters("@outputnumber").Direction = ParameterDirection.Output
.Parameters.AddWithValue("@inputnumber", inputvalue)
returnvalue = cmd.ExecuteScalar()
End With
Thanks for all and any help.
sorry for the confusion my vb code now looks like this
With cmdgetgame
.CommandType = CommandType.StoredProcedure
.CommandText = "getgamenumber"
.Parameters.Add("@outputnumber", SqlDbType.BigInt).Value = outputnumber
.Parameters("@outputnumber").Direction = ParameterDirection.Output
.Parameters.AddWithValue("@inputnumber", inputvalue)
cmd.ExecuteNonQuery()
returnvalue = cmdgetgame.Parameters("@outputnumber").Value
End With
and my stored proc like this
ALTER PROCEDURE dbo.getgamenumber
( @outputnumber bigint , @inputnumber bigint) AS SELECT ggnumber FROM statstable WHERE (gindex = @inputnumber)
but I still dont get the value I expect.