Solved

access stored proc value from vb.net

Posted on 2012-12-28
2
179 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 75

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

840 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