Running a method to insert some data into a table EventsManaged using an sql query which returns an error
"incorrect syntax near 'WHERE'"
but I can't see my mistake?
The method is in an EventDAL and being called from an open form. I used breakpoints and checked the correct type of data was being entered- any help?
public static int AddAllToEventsManaged( string areaType, string areaName, double cost, double costPer, int v, int id)
{
using (SqlConnection connection = new SqlConnection(_connectionstring))
{
connection.Open();
string SQLquery1 = string.Format("INSERT INTO EventsManaged (AreaType, AreaName, Cost, CostPer) VALUES ('{0}','{1}','{2}','{3}') WHERE AreaID = '{4}' AND CustomerID = '{5}'", areaType, areaName, cost, costPer, v, id);
SqlCommand insertProjectCommand = new SqlCommand(SQLquery1, connection);
int rowsAffected = insertProjectCommand.ExecuteNonQuery();
connection.Close();
return rowsAffected;
}
}
}