Solved

determine the value of return from a stored procedure

Posted on 2011-02-11
4
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

687 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