Solved

determine the value of return from a stored procedure

Posted on 2011-02-11
4
275 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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