?
Solved

output parameter in execute reader

Posted on 2009-04-17
3
Medium Priority
?
332 Views
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)
 
        conn2.Open()
 
        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
 
        cmd.Parameters.Add(countPrm)
 
        Session("ok") = countPrm.Value
        Dim dr As Data.SqlClient.SqlDataReader = Nothing
 
        dr = cmd2.ExecuteReader()
        While dr.Read()
         
        End While
        conn2.Close()
        conn2.Dispose()
    End Sub

Open in new window

0
Comment
Question by:gianitoo
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
spprivate earned 2000 total points
ID: 24169110
This line is the problem


        cmd.Parameters.Add(countPrm)

This should be


        cmd2.Parameters.Add(countPrm)
0
 
LVL 1

Author Comment

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

Expert Comment

by:spprivate
ID: 24169225
That is not from this procedure.It is elsewhere in your code.
Where are you checking that in your code
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

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