?
Solved

access stored proc value from vb.net

Posted on 2012-12-28
2
Medium Priority
?
182 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
[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 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 2000 total points
ID: 38732865
Be sure and specify an OUTPUT parameter:

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

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

In this article I will describe the Backup & Restore 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.
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

764 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