Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

determine the value of return from a stored procedure

My stored procedure does this:

declare @result integer =0;
  select @result = sign(count(1)) from users where USERNAME=@UserName and PASSWORD=@Password and IS_ACTIVE = '1';
  return @result;

In vb.net how do I return the value of @result to my vb.net code?
0
vbnetcoder
Asked:
vbnetcoder
  • 2
  • 2
1 Solution
 
quizwedgeCommented:
In your stored procedure, you'll want to declare @result as one of the parameters as follows:

@result as int OUTPUT

In VB.NET, you'll want to pass in the parameter as follows:

Dim parameterResult As SqlParameter = New SqlParameter("@result", SqlDbType.int)
        parameterResult.Direction = ParameterDirection.Output
        myCommand.SelectCommand.Parameters.Add(parameterResult)

You can then get the value from parameterNewId.value
0
 
vbnetcoderAuthor Commented:
AS
BEGIN
      SET NOCOUNT ON;
      @result as int OUTPUT;


That code give me a error: "Incorrect syntax near @result
0
 
quizwedgeCommented:
The @result line goes above "AS" and below "ALTER PROCEDURE"
0
 
vbnetcoderAuthor Commented:
ty
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now