This is how I set up my command. It stops with the first parameter, UpdateType. This code is being updated from VB.NET 2008 version.
Dim db As New DB()
Dim cmd As SqlCommand = New SqlCommand()
'Put into an object, and use AddWithValue due to Parameters.Add being deprecated.
Dim UpdateType As String = "PARAMETERS"
If IsNewJob Then
cmd.CommandText = "sp_MB_AddJob"
Else
cmd.CommandText = "sp_MB_UpdateJob"
cmd.Parameters.AddWithValue("@UpdateType", SqlDbType.NVarChar).Value = UpdateType
cmd.Parameters.AddWithValue("@OrigJobName", OrigJobName.ToString)
End If
cmd.Parameters.AddWithValue("@UserID", CInt(Utils.GetLoggedInUserID))
cmd.Parameters.AddWithValue("@ProjectName", ProjectName.ToString)
Add(String, Object)is deprecated, notAdd(String, SqlDbType). UseParameters.Addfor your@UpdateTypeparameter (and the others if they aren't being treated as objects). SqlParameterCollection.Add Method.AddWithValuedoesn't support supplying the datatype.IsNewJobhere, not defined.