output parameter in execute reader

Posted on 2009-04-17
Last Modified: 2012-05-06
i am trying to get the output for parameter status.  i am getting this error below.  Could you check my sub and make sure that is well written.  

Error-Procedure 'wmItemOptionVerifyCustomerSp' expects parameter '@status', which was not supplied.
Public Sub VerifyCustomer()

        Dim strConn2 As String = ConfigurationManager.ConnectionStrings("Test").ConnectionString

        Dim conn2 As New SqlConnection(strConn2)


        Dim cmd2 As New Data.SqlClient.SqlCommand("wmItemOptionVerifyCustomerSp", conn2)

        cmd2.CommandType = CommandType.StoredProcedure

        cmd2.Parameters.Add("@cust_num", SqlDbType.NVarChar).Value = custnumber.Text

        cmd2.Parameters.Add("@name", SqlDbType.NVarChar).Value = fullname.Text

        cmd2.Parameters.Add("@zip", SqlDbType.NVarChar).Value = zip.Text


        Dim countPrm As New SqlParameter("@status", SqlDbType.NVarChar)

        countPrm.Direction = ParameterDirection.Output


        Session("ok") = countPrm.Value

        Dim dr As Data.SqlClient.SqlDataReader = Nothing

        dr = cmd2.ExecuteReader()

        While dr.Read()


        End While



    End Sub

Open in new window

Question by:gianitoo
    LVL 15

    Accepted Solution

    This line is the problem


    This should be

    LVL 1

    Author Comment

    now i get this
    Error-String[3]: the Size property has an invalid size of 0.
    LVL 15

    Expert Comment

    That is not from this procedure.It is elsewhere in your code.
    Where are you checking that in your code

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    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…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 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

    18 Experts available now in Live!

    Get 1:1 Help Now