please help with sp

Discussion in 'ASP .Net Web Services' started by Alex, Nov 21, 2008.

  1. Alex

    Alex Guest

    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
    Alex, Nov 21, 2008
    #1
    1. Advertising

  2. Alex

    Alex Guest

    It’s solved. It was parameter’s misspelling.

    Thanks


    "Alex" wrote:

    > 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
    >
    Alex, Nov 21, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JC
    Replies:
    4
    Views:
    7,951
    Jeff C
    Jul 8, 2004
  2. Replies:
    4
    Views:
    492
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    526
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,723
    Mike Hewson
    Jan 7, 2005
  5. mera
    Replies:
    7
    Views:
    1,081
Loading...

Share This Page