Results 1 to 6 of 6

Thread: Error: Procedure or function usp_MoveData expects param

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Posts
    8

    Error: Procedure or function usp_MoveData expects param

    Hi all,

    I am trying to execute a stored procedure from VB.Net. I get the error: Procedure or Function usp_MoveData expects parameter @Wdate which was not supplied. My vb code is below. I am sure it is a simple fix for all you gurus.

    Using my Cmd As New SqlCommand("usp_MoveData"), SqlConn)
    myCmd.Parameters.AddWithValue("@WDate", dtWorshipDate.Value)
    SqlConn.Open()
    Try
    myCmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    EndTry
    EndUsing

    Thanks for any help in advance.

  2. #2
    Addicted Member thetimmer's Avatar
    Join Date
    Jan 2014
    Location
    Plano, Texas
    Posts
    243

    Re: Error: Procedure or function usp_MoveData expects param

    @WDate does not equal @Wdate

    you need to match what the proc wants.
    Also, please remember to use code tags when posting code
    Code:
    Using my Cmd As New SqlCommand("usp_MoveData"), SqlConn)
    myCmd.Parameters.AddWithValue("@WDate", dtWorshipDate.Value)
    SqlConn.Open()
    Try
    myCmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    EndTry
    EndUsing
    _____________
    Tim

    If anyone's answer has helped you, please show your appreciation by rating that answer.
    When you get a solution to your issue remember to mark the thread Resolved.


    reference links

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Posts
    8

    Re: Error: Procedure or function usp_MoveData expects param

    I tried that with still the same message.

    Quote Originally Posted by thetimmer View Post
    @WDate does not equal @Wdate

    you need to match what the proc wants.
    Also, please remember to use code tags when posting code
    Code:
    Using my Cmd As New SqlCommand("usp_MoveData"), SqlConn)
    myCmd.Parameters.AddWithValue("@WDate", dtWorshipDate.Value)
    SqlConn.Open()
    Try
    myCmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    EndTry
    EndUsing

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2006
    Posts
    8

    Re: Error: Procedure or function usp_MoveData expects param

    I tried that with still the same message.

    Quote Originally Posted by thetimmer View Post
    @WDate does not equal @Wdate

    you need to match what the proc wants.
    Also, please remember to use code tags when posting code
    Code:
    Using my Cmd As New SqlCommand("usp_MoveData"), SqlConn)
    myCmd.Parameters.AddWithValue("@WDate", dtWorshipDate.Value)
    SqlConn.Open()
    Try
    myCmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    EndTry
    EndUsing

  5. #5
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Error: Procedure or function usp_MoveData expects param

    Try adding the following before the ExecuteNonQuery call.
    Code:
    cmd.CommandType = System.Data.CommandType.StoredProcedure
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  6. #6
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,543

    Re: Error: Procedure or function usp_MoveData expects param

    Quote Originally Posted by thetimmer View Post
    @WDate does not equal @Wdate

    you need to match what the proc wants.
    Also, please remember to use code tags when posting code
    Code:
    Using my Cmd As New SqlCommand("usp_MoveData"), SqlConn)
    myCmd.Parameters.AddWithValue("@WDate", dtWorshipDate.Value)
    SqlConn.Open()
    Try
    myCmd.ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.ToString)
    EndTry
    EndUsing
    Doesn't matter... SQL Server isn't that picky... yes, it's a good idea to match, but in the end, the case of the parameters is irrelevant. What does matter is the spelling.

    Quote Originally Posted by wild_bill View Post
    Try adding the following before the ExecuteNonQuery call.
    Code:
    cmd.CommandType = System.Data.CommandType.StoredProcedure
    That probably will do it... by default, the CommandType is text, so when you give it a table or sproc, you need to make sure you change it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width