Solved

access stored proc value from vb.net

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

14 Experts available now in Live!

Get 1:1 Help Now