P
Phenom
I'm receiving the following error when I try to use a stored proc in my
code:
SqlParameter with ParameterName '@unionRep' is not contained by this
SqlParameterCollection
I have searched several newsgroups and found similar situations, but so
far none of the solutions have worked for me.
*Note, I have tried setting the connection and opening it both before
and after setting the command text.
Please help!
Thanks in advance.
Here is the code I have:
SqlSelectCommand1.CommandType = CommandType.StoredProcedure
SqlSelectCommand1.CommandText = "sp_UpdateContractOut1"
Dim param As SqlParameter = New SqlParameter("@unionRep",
SqlDbType.NVarChar, 50)
Dim param1 As SqlParameter = New SqlParameter("@unionSign",
SqlDbType.SmallDateTime)
Dim param2 As SqlParameter = New
SqlParameter("@areaUnionRep", SqlDbType.NVarChar, 50)
Dim param3 As SqlParameter = New
SqlParameter("@areaUnionRepSign", SqlDbType.SmallDateTime)
Dim param4 As SqlParameter = New SqlParameter("@unionComm",
SqlDbType.NVarChar, 255)
Dim param5 As SqlParameter = New
SqlParameter("@companyCoord", SqlDbType.NVarChar, 50)
Dim param6 As SqlParameter = New
SqlParameter("@companySign", SqlDbType.SmallDateTime)
Dim param7 As SqlParameter = New SqlParameter("@maintSupt",
SqlDbType.NVarChar, 50)
Dim param8 As SqlParameter = New
SqlParameter("@maintSuptSign", SqlDbType.SmallDateTime)
Dim param9 As SqlParameter = New SqlParameter("@coordComm",
SqlDbType.NVarChar, 255)
Dim param10 As SqlParameter = New SqlParameter("@ID",
SqlDbType.Int)
SqlSelectCommand1.Parameters("@unionRep").Value =
unionRep.Text
SqlSelectCommand1.Parameters("@unionSign").Value =
unionSign.Text
SqlSelectCommand1.Parameters("@areaUnionRep").Value =
areaUnionRep.Text
SqlSelectCommand1.Parameters("@areaUnionRepSign").Value =
areaUnionRepSign.Text
SqlSelectCommand1.Parameters("@unionComm").Value =
unionComm.Text
SqlSelectCommand1.Parameters("@companyCoord").Value =
companyCoord.Text
SqlSelectCommand1.Parameters("@companySign").Value =
companySign.Text
SqlSelectCommand1.Parameters("@maintSupt").Value =
MaintSupt.Text
SqlSelectCommand1.Parameters("@maintSuptSign").Value =
maintSuptSign.Text
SqlSelectCommand1.Parameters("@coordComm").Value =
coordComm.Text
SqlSelectCommand1.Parameters("@ID").Value = txtWO.Text
SqlSelectCommand1.Connection = SqlConnection1
SqlConnection1.Open()
Try
SqlSelectCommand1.ExecuteNonQuery()
lblUpdateSuccess.Visible = True
btnSuccess.Visible = True
Catch ex As Exception
lblFail.Visible = True
btnFail.Visible = True
Finally
SqlConnection1.Close()
End Try
code:
SqlParameter with ParameterName '@unionRep' is not contained by this
SqlParameterCollection
I have searched several newsgroups and found similar situations, but so
far none of the solutions have worked for me.
*Note, I have tried setting the connection and opening it both before
and after setting the command text.
Please help!
Thanks in advance.
Here is the code I have:
SqlSelectCommand1.CommandType = CommandType.StoredProcedure
SqlSelectCommand1.CommandText = "sp_UpdateContractOut1"
Dim param As SqlParameter = New SqlParameter("@unionRep",
SqlDbType.NVarChar, 50)
Dim param1 As SqlParameter = New SqlParameter("@unionSign",
SqlDbType.SmallDateTime)
Dim param2 As SqlParameter = New
SqlParameter("@areaUnionRep", SqlDbType.NVarChar, 50)
Dim param3 As SqlParameter = New
SqlParameter("@areaUnionRepSign", SqlDbType.SmallDateTime)
Dim param4 As SqlParameter = New SqlParameter("@unionComm",
SqlDbType.NVarChar, 255)
Dim param5 As SqlParameter = New
SqlParameter("@companyCoord", SqlDbType.NVarChar, 50)
Dim param6 As SqlParameter = New
SqlParameter("@companySign", SqlDbType.SmallDateTime)
Dim param7 As SqlParameter = New SqlParameter("@maintSupt",
SqlDbType.NVarChar, 50)
Dim param8 As SqlParameter = New
SqlParameter("@maintSuptSign", SqlDbType.SmallDateTime)
Dim param9 As SqlParameter = New SqlParameter("@coordComm",
SqlDbType.NVarChar, 255)
Dim param10 As SqlParameter = New SqlParameter("@ID",
SqlDbType.Int)
SqlSelectCommand1.Parameters("@unionRep").Value =
unionRep.Text
SqlSelectCommand1.Parameters("@unionSign").Value =
unionSign.Text
SqlSelectCommand1.Parameters("@areaUnionRep").Value =
areaUnionRep.Text
SqlSelectCommand1.Parameters("@areaUnionRepSign").Value =
areaUnionRepSign.Text
SqlSelectCommand1.Parameters("@unionComm").Value =
unionComm.Text
SqlSelectCommand1.Parameters("@companyCoord").Value =
companyCoord.Text
SqlSelectCommand1.Parameters("@companySign").Value =
companySign.Text
SqlSelectCommand1.Parameters("@maintSupt").Value =
MaintSupt.Text
SqlSelectCommand1.Parameters("@maintSuptSign").Value =
maintSuptSign.Text
SqlSelectCommand1.Parameters("@coordComm").Value =
coordComm.Text
SqlSelectCommand1.Parameters("@ID").Value = txtWO.Text
SqlSelectCommand1.Connection = SqlConnection1
SqlConnection1.Open()
Try
SqlSelectCommand1.ExecuteNonQuery()
lblUpdateSuccess.Visible = True
btnSuccess.Visible = True
Catch ex As Exception
lblFail.Visible = True
btnFail.Visible = True
Finally
SqlConnection1.Close()
End Try