Solved

determine the value of return from a stored procedure

Posted on 2011-02-11
4
271 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
Comment Utility
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
Comment Utility
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
Comment Utility
The @result line goes above "AS" and below "ALTER PROCEDURE"
0
 

Author Closing Comment

by:vbnetcoder
Comment Utility
ty
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Open a folder with partial name 14 26
Crystal Report for VS2013 17 35
ASP.NET reading ATOM 2 19
Closing all open child forms. 4 21
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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now