Hi, I am using vs 2008 using the winforms application in vb.net. I have a database with one table in which there are two columns, as well as a stored procedure. The stored procedure must take an input value, match this value with one column in the table, and then return the corresponding value from another column; other than that doesnt.It returns 1 or 0, can someone please 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 saved proc is called that way
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 everything and for any help.
Sorry for the confusion, my vb code now looks like
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 procedure like this
ALTER PROCEDURE dbo.getgamenumber
( @outputnumber bigint ,
@inputnumber bigint)
AS
SELECT ggnumber
FROM statstable
WHERE (gindex = @inputnumber)
but I still do not get the expected value.
simon source
share