Stored Procedure - Missing Parameter?

davele

Member
Joined
Sep 29, 2009
Messages
12
Programming Experience
5-10
Hey guys, I posted this in the ADO.NET but didn't get much response. I'm trying to run a stored procedure providing 1 input parameter and retrieving 2 output parameters. When I run this I get

"Procedure or function 'MESSP_Get_PLCKitColour' expects parameter '@KitNo', which was not supplied."

Dim connData As New System.Data.SqlClient.SqlConnection(gstrConnection )
Dim commData As New System.Data.SqlClient.SqlCommand("MESSP_Get_PLCKit Colour")

connData.Open()
commData.CommandType = CommandType.StoredProcedure
commData.Connection = connData

commData.Parameters.Add(New SqlClient.SqlParameter("@ProdCode", SqlDbType.VarChar, 12, ParameterDirection.Input)).Value = strProdCode
commData.Parameters.Add(New SqlClient.SqlParameter("@KitNo", SqlDbType.Int, ParameterDirection.Output))
commData.Parameters.Add(New SqlClient.SqlParameter("@ColourNo", SqlDbType.Int, ParameterDirection.Output))
commData.ExecuteNonQuery()
connData.Close()

Stored Procedure Code:
CREATE procedure [dbo].[MESSP_Get_PLCKitColour]
@ProdCode varchar(12),
@KitNo Integer OUTPUT,
@ColourNo Integer OUTPUT
as

SET NOCOUNT ON -- Reduce overhead.

Select @KitNo=123
Select @ColourNo=1234

RETURN 0
GO
 
Back
Top