Solved

access stored proc value from vb.net

Posted on 2012-12-28
2
174 Views
Last Modified: 2013-01-03
I have a stored proc named  spTierCredits_PlayerID
(I am passing in an input parameter named playerid)

 that does a bunch of processing to dettermine an end value for

DECLARE @TotalTableSlotTierCredits AS DECIMAL(18, 2);

....
 

SET @TotalTableSlotTierCredits = isnull(@TotalTableTierCredits,0) + isnull(@TotalSlotTierCredits,0)

From what I have read I should be able to get this in a vb.net app without defining
@TotalTableSlotTierCredits  as an output variable.

I am having some trouble though


 strConn = ConfigurationManager.ConnectionStrings("DBConnectStringPlayerTierInfo").ConnectionString
            Dim cn As New SqlClient.SqlConnection(strConn)

            cn.Open()

            Dim strsql As String
            strsql = "spTierCredits_PlayerID"
            Dim param As New SqlClient.SqlParameter
            Dim cmd As New SqlClient.SqlCommand(strsql, cn)
            cmd.CommandType = CommandType.StoredProcedure
            param = cmd.Parameters.Add("@playerid", SqlDbType.VarChar, 0)
         
            cmd.Parameters(0).Value = intPlayerid
            Dim rdr As SqlClient.SqlDataReader = cmd.ExecuteReader()

            If rdr.Read() = False Then
                lblFeedback.Text = "No Player Id found for card swiped"
                lblFeedback.CssClass = "errorMsg"
                divFeedbackHolder.Visible = True
                lblTotalTierCreditsValue.Text = ""
                rdr.Close()
                txtCardID.Text = ""
                Exit Sub
            Else
                intPlayerid = rdr.Item("PlayerID")
            End If

            rdr.Close()

            cn.Close()
            txtCardID.Text = ""
0
Comment
Question by:johnnyg123
2 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 38728223
Does your sproc return this value?
0
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 500 total points
ID: 38732865
Be sure and specify an OUTPUT parameter:

http://msdn.microsoft.com/en-us/library/ms188655.aspx
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

762 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

20 Experts available now in Live!

Get 1:1 Help Now