troubleshooting Question

Webform with checkmark box

Avatar of sharris_glascol
sharris_glascolFlag for United States of America asked on
SecurityC#SQL
1 Comment1 Solution82 ViewsLast Modified:
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);
 
                }
 
 
 
            }
 
 
 
        }
ASKER CERTIFIED SOLUTION
Lukasz Zielinski
software developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2008

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros