Avatar of sharris_glascol
sharris_glascol
Flag for United States of America asked on

Webform with checkmark box

I am getting a error must declare the scalar variable "@qualityControl "

I think it's because in c# i have it as a checkmark box and in sql it is a bit.  how do I arrange the Parameter? see code.

using (SqlConnection SqlConn = new SqlConnection
                     ("Data Source = gcm10; Initial Catalog = Vendor; Integrated Security = True"))
            {
                string query = "Insert into vendor_approval(name, add1, add2, city, state, zipcode, phone_number, fax_number, contact_name, product_vendor, cert_quality, quality_assurance, product_sample, quality_control, specified_inspection, certificate_conformance, inspection_testing, supplier_testing, quality_system)" +
                    "values (@name, @add1, @add2, @city, @state, @zipcode, @phone_number, @fax_number, @contact_name, @product_vendor, @cert_quality, @Quality_Assurance, @Product_Sample, @qualityControl, @specified_inspection, @certificate_conformance, @inspection_testing, @supplier_testing, @quality_Testing)";
                SqlCommand cmd = new SqlCommand(query, SqlConn);
                cmd.Connection.Open();
                cmd.Parameters.AddWithValue("@name", Ven_Name.Text);
                cmd.Parameters.AddWithValue("@add1", Add_1.Text);
                cmd.Parameters.AddWithValue("@add2", Add_2.Text);
                cmd.Parameters.AddWithValue("@city", City.Text);
                cmd.Parameters.AddWithValue("@state", State_list.Text);
                cmd.Parameters.AddWithValue("@zipcode", Zip.Text);
                cmd.Parameters.AddWithValue("@phone_number", ASPphone.Text);
                cmd.Parameters.AddWithValue("@fax_number", ASPfax.Text);
                cmd.Parameters.AddWithValue("@contact_name", Contact.Text);
                cmd.Parameters.AddWithValue("@product_vendor", Ven_Prod.Text);
                cmd.Parameters.AddWithValue("@cert_quality", check_cert.Text);
                cmd.Parameters.AddWithValue("@Quality_Assurance", check_quality.Text);
                cmd.Parameters.AddWithValue("@Product_Sample", Check_product.Text);
                cmd.Parameters.AddWithValue("@quality_Control", check_quality.Text);
                cmd.Parameters.AddWithValue("@specified_inspection", check_inspection.Text);
                cmd.Parameters.AddWithValue("@certificate_conformance", check_conformance.Text);
                cmd.Parameters.AddWithValue("@inspection_testing", check_insptest.Text);
                cmd.Parameters.AddWithValue("@supplier_testing", check_suppliertest.Text);
                cmd.Parameters.AddWithValue("@quality_Testing", check_qualitysystem.Text);
               
                try
                {
                    cmd.ExecuteNonQuery();
 
                }
                catch (Exception ex)
                {
                    throw new Exception("Error " + ex.Message);
 
                }
 
 
 
            }
 
 
 
        }
SecurityC#SQL

Avatar of undefined
Last Comment
Lukasz Zielinski

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Lukasz Zielinski

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck