when I try to insert data using form it throws the exception(e1) "Error Occured Please Try Again" you have an error in your sql syntax check the manual that corresponds to your Mysql server version for the right syntax to use near " at line1
Please help to correct this error
StringBuilder query = new StringBuilder();
query.Append("Insert Into my_project_data.vehicle(ChassyNumber ,ManufacturedYear, EngineCapacity,Price,Features ,VehicleBrand , VehicleType) Values('" + chassy_txt.Text + "','"+manufac_year_txt.Text+"','"+Engine_Capasity_txt.Text+"','"+Price_txt.Text+"','"+Features_rich_txt.Text+"',");
Classes.DB_Connectivity db = new Classes.DB_Connectivity();
try
{
db.openConnection();
if ((radioButton1.Checked || radioButton2.Checked) && (radioButton7.Checked || radioButton11.Checked) && ( manufac_year_txt.Text != "" && Engine_Capasity_txt.Text != "" && Price_txt.Text != "" && Features_rich_txt.Text != ""))
{
if (radioButton1.Checked)
{
query.Append("BMW ,");
}
if (radioButton2.Checked)
{
query.Append("Benz , ");
}
if (radioButton7.Checked)
{
query.Append("Car ,");
}
if (radioButton11.Checked)
{
query.Append("SUV ,");
}
if ( manufac_year_txt.Text != "" && Engine_Capasity_txt.Text != "" && Price_txt.Text != "" && Features_rich_txt.Text != "")
{
query.Append(" '"+manufac_year_txt.Text+"', '"+Engine_Capasity_txt.Text+"','"+Price_txt.Text+"','"+Features_rich_txt.Text+"'");
}
MySqlCommand cmd = new MySqlCommand(query.ToString(), db.conn);
cmd.ExecuteNonQuery();
MessageBox.Show(" Vehicle Registration Successfull ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Fill All Required Information ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception e1)
{
MessageBox.Show("Error Occured Please Try Again " +e1.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}