I have a very simple stored proc which selects records based on ID provided by user.

```
ALTER PROCEDURE [dbo].[sp_getcheck]
@ID int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.

SET NOCOUNT ON;
If NOT EXISTS(select * from mytable where ID=@ID)
  BEGIN
    RAISERROR (
    'The ID you entered %d is invalid',
    11,
    1,
    @ID);
  END
END

```

What we would like to do is have user enter an ID and check to see if it exists on our database.

If yes, user is redirected to a page of his/her choice.

If no, we would like to keep user on same screen with a message that ID number entered Q1254 is invalid.

That error is raised on the stored procedure and we would like C# code to display that message on the screen for the user.

Here is that code:

```
protected void chk_Click(object sender, EventArgs e)
{
    if (!string.IsNullOrEmpty(accountnumber.Text))
    {
        SqlConnection Conn = default(SqlConnection);

        //Read in connection String
        Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Constr"].ConnectionString);
        Conn.Open();

        SqlCommand cmd = new SqlCommand("sp_getcheck", Conn);
        //Retrieve the value of the output parameter

        //Add the output parameter to the command object
        cmd.Parameters.AddWithValue("@ID", checknumber.Text);
        SqlParameter outPutParameter = new SqlParameter();
        SqlDataReader dr = cmd.ExecuteReader();

        //Retrieve the value of the output parameter

        if (dr.Read())
        {
            try
            {
                //we add a hidden field called IsValid to the markup and set the IsValid value in the event handler here.
                imgstatus.ImageUrl = "images/Icon_Available.gif";
                lblStatus.ForeColor = Color.Green;

                //redirect based on value of hidden form field called evalue
                var evalue = hequipID.Value;
                if (evalue == "1")
                {
                    Response.Redirect("Air.aspx?pageId=1");
                }
                if (evalue == "2")
                {
                    Response.Redirect("Land.aspx?pageId=2");
                }

                //ID exists, get form fields and store db values in them:
                //txtfname.Text = (dr["FullName"].ToString());

            }
            catch (SqlException ex)
            {
                //Something is wrong with this taxpayer's account.
                imgstatus.ImageUrl = "images/NotAvailable.jpg";
                lblStatus.ForeColor = Color.Red;
                lblStatus.Text = ex.Message;
                chk.BackColor = Color.Silver;
                System.Threading.Thread.Sleep(2000);
            }
        }
    }
  }

```

When I tried to run the code, I get the following error message:

`Procedure or function 'sp_getchech' expects parameter '@ID', which was not supplied`

Surely I am doing something wrong.

Any ideas how to resolve this?

The threads referenced is different from mine. That thread is missing some parameters. 

My is not missing any parameters, therefore, not a duplicate of referenced thread.