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.
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
Re: Error: Procedure or function usp_MoveData expects param
I tried that with still the same message.
Quote:
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
Re: Error: Procedure or function usp_MoveData expects param
I tried that with still the same message.
Quote:
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
Re: Error: Procedure or function usp_MoveData expects param
Try adding the following before the ExecuteNonQuery call.
Code:
cmd.CommandType = System.Data.CommandType.StoredProcedure
Re: Error: Procedure or function usp_MoveData expects param
Quote:
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.
Quote:
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