How to call a Stored Procedure?

Apr 8 2008 4:08 AM

Dear Friend,

I typed this code and run the application.......... But there is an error... Please help me to verify this problem.........

 private void btnSave_Click(object sender, EventArgs e)
        {
            string connectionstring = "Data Source=LOCALSERVER;Initial Catalog=ACME_ERP;Integrated Security=True ";
            SqlConnection s = new SqlConnection(connectionstring);

            SqlCommand cmd = new SqlCommand("usp_insertcustomer", s);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add(@cust_code, this.cmdCustCode.Text);
            cmd.Parameters.Add(@cust_name, this.txtCustName.Text);

//(@cust_code and @cust_name are parameters defined in the sql procedure

            cmd.ExecuteReader();

        }


//Error 1 The name 'cust_code' does not exist in the current


Answers (3)