Solved

determine the value of return from a stored procedure

Posted on 2011-02-11
4
280 Views
Last Modified: 2012-05-11
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
Comment
Question by:vbnetcoder
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
quizwedge earned 250 total points
ID: 34875800
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
 

Author Comment

by:vbnetcoder
ID: 34875887
AS
BEGIN
      SET NOCOUNT ON;
      @result as int OUTPUT;


That code give me a error: "Incorrect syntax near @result
0
 
LVL 14

Expert Comment

by:quizwedge
ID: 34875951
The @result line goes above "AS" and below "ALTER PROCEDURE"
0
 

Author Closing Comment

by:vbnetcoder
ID: 34876790
ty
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question