please help with sp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top