N
Niksa Baldun
Check this out. I try to execute a stored procedure on SQL Server 2000 like
this:
cmdA = New SqlClient.SqlCommand("NP", cnnMain)
With cmdA
.CommandType = CommandType.StoredProcedure
.Parameters.Add(New SqlClient.SqlParameter("@Name", strName))
.Parameters.Add(New SqlClient.SqlParameter("@Type", 4))
.Parameters.Add(New SqlClient.SqlParameter("@ID", 0))
Try
.ExecuteNonQuery()
Catch excA As SqlClient.SqlException
MsgBox(excA.Message)
End Try
End With
I get the following error message:
Procedure 'NP' expects parameter '@ID', which was not supplied.
As you can clearly see, the parameter @ID *was* supplied with the value of
zero. If I put any value other than zero, it works fine. If I declare a
variable like this:
Dim intA As Integer = 0
and then pass intA as parameter value, it also works fine. Can anybody
explain this?
Thanks,
Niksa Baldun
this:
cmdA = New SqlClient.SqlCommand("NP", cnnMain)
With cmdA
.CommandType = CommandType.StoredProcedure
.Parameters.Add(New SqlClient.SqlParameter("@Name", strName))
.Parameters.Add(New SqlClient.SqlParameter("@Type", 4))
.Parameters.Add(New SqlClient.SqlParameter("@ID", 0))
Try
.ExecuteNonQuery()
Catch excA As SqlClient.SqlException
MsgBox(excA.Message)
End Try
End With
I get the following error message:
Procedure 'NP' expects parameter '@ID', which was not supplied.
As you can clearly see, the parameter @ID *was* supplied with the value of
zero. If I put any value other than zero, it works fine. If I declare a
variable like this:
Dim intA As Integer = 0
and then pass intA as parameter value, it also works fine. Can anybody
explain this?
Thanks,
Niksa Baldun