A
Alex
I’m getting an error on executing SQLCmd.ExecuteNonQuery().
It’s saying a one parameter which is output parameters wasn’t supplied
Dim SQLCmd As New SqlClient.SqlCommand("GetDescrForMatricCode", SQLCon)
SQLCmd.CommandType = CommandType.StoredProcedure
varDropDownList2 = DropDownList2.Text
SQLCmd.Parameters.AddWithValue("MetricCode", varDropDownList2)
SQLCmd.Parameters.AddWithValue("MetrDescr", "")
SQLCmd.Parameters("MetrDescr").Direction = ParameterDirection.Output
SQLCmd.CommandText = "GetDescrForMatricCode"
SQLCmd.Connection = SQLCon
SQLCmd.ExecuteNonQuery() ‘ is not working returning an error “the
@MetrDescr wasn’t suppliedâ€
Label1.Text = SQLCmd.Parameters("MetrDescr").Value
SQLCon.Close()
‘**********************
Here is a stored procedure:
ALTER PROCEDURE [dbo].[GetDescrForMatricCode]
(@MetricCode varchar(11), @MetricDescr varchar (50) OUTPUT)
AS
/* SET NOCOUNT ON */
SELECT @MetricDescr=[DescriptionShort] FROM [dNAV_ScoreCard_Metrics]
WHERE [MetricCode]=@MetricCode
RETURN
It’s saying a one parameter which is output parameters wasn’t supplied
Dim SQLCmd As New SqlClient.SqlCommand("GetDescrForMatricCode", SQLCon)
SQLCmd.CommandType = CommandType.StoredProcedure
varDropDownList2 = DropDownList2.Text
SQLCmd.Parameters.AddWithValue("MetricCode", varDropDownList2)
SQLCmd.Parameters.AddWithValue("MetrDescr", "")
SQLCmd.Parameters("MetrDescr").Direction = ParameterDirection.Output
SQLCmd.CommandText = "GetDescrForMatricCode"
SQLCmd.Connection = SQLCon
SQLCmd.ExecuteNonQuery() ‘ is not working returning an error “the
@MetrDescr wasn’t suppliedâ€
Label1.Text = SQLCmd.Parameters("MetrDescr").Value
SQLCon.Close()
‘**********************
Here is a stored procedure:
ALTER PROCEDURE [dbo].[GetDescrForMatricCode]
(@MetricCode varchar(11), @MetricDescr varchar (50) OUTPUT)
AS
/* SET NOCOUNT ON */
SELECT @MetricDescr=[DescriptionShort] FROM [dNAV_ScoreCard_Metrics]
WHERE [MetricCode]=@MetricCode
RETURN