INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Error says Parameter not included?

Error says Parameter not included?

(OP)
Hi Folks

Working on a VB 2008 app with SQL Server Express 2008 R2 back end.  I have the following code I'm using to call a stored proc in SQL Server that takes one parameter, @Par1, which is a character value.  The Value of Param1 (being passed in at the top of the function is "HO" (could be any two-letter combination).  

When I try to run this the call seems to be finding the SP just fine, but it tells me that "Procedure or function '<proc Name>' expects parameter '@Par1', which was not supplied."  You can see plainly below that it is, in fact, being sent.

CODE

    Public Function FillDtSp1(ByVal ProcName As String, ByVal Param1 As String) As DataTable

        Dim dcLk As New SqlCommand(ProcName, cnHTT)
        Dim daFillDt As New SqlDataAdapter(dcLk)

        daFillDt.SelectCommand.Parameters.Add("@Par1", SqlDbType.Char, (40)).Value = Param1
        Dim dt1 As New DataTable

        If cnHTT.State <> ConnectionState.Open Then cnHTT.Open()
        daFillDt.Fill(dt1)
        If cnHTT.State <> ConnectionState.Closed Then cnHTT.Close()

        Return dt1

    End Function

I've tried this as both an added parameter on the SQLCommand object and on the SQLDataAdapter, results are the same.  Any ide why this might be happening to me?

Craig

Amesville

RE: Error says Parameter not included?

(OP)
Think I answered my question for myself - I added a property call to the Command opject setting it as a stored procedure instead of Text and that seems to have fixed it.

RE: Error says Parameter not included?

FYI, you'll want to post your VB.Net database questions in the VB.Net forum.  This forum got its name before there was a VB.Net, was intended for VB5 and VB6 database issues, and isn't seeing a lot of traffic these days.

An unforeseen consequence of the information revolution has been the exponential propagation of human error.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close