-
Apr 23rd, 2014, 09:59 AM
#1
Thread Starter
New Member
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.
-
Apr 23rd, 2014, 10:10 AM
#2
Addicted Member
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
-
Apr 23rd, 2014, 10:21 AM
#3
Thread Starter
New Member
Re: Error: Procedure or function usp_MoveData expects param
I tried that with still the same message.
Originally Posted by thetimmer
@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
-
Apr 23rd, 2014, 10:21 AM
#4
Thread Starter
New Member
Re: Error: Procedure or function usp_MoveData expects param
I tried that with still the same message.
Originally Posted by thetimmer
@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
-
Apr 23rd, 2014, 10:35 AM
#5
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
-
Apr 23rd, 2014, 01:58 PM
#6
Re: Error: Procedure or function usp_MoveData expects param
Originally Posted by thetimmer
@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.
Originally Posted by wild_bill
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|