This is the code I have
static public void GenerateOrder(string Time, string Date)
{
MySqlConnection conn = new MySqlConnection("server = localhost; uid = root; database = coursework; password = root;");
conn.Open();
MessageBox.Show(Date + Time);
string statement = ("INSERT INTO order (CustomerID, Name, Date, Time, Price) VALUES(" + Users.UserID + ",'" + Users.Firstname + "','" + Date + "','" + Time + "'," + OrderPrice + ");");
MessageBox.Show(statement);
MySqlCommand cmd = new MySqlCommand(statement, conn);
cmd.ExecuteNonQuery();
MessageBox.Show("Order successfully placed.");
conn.Close();
}
Why does it give me the Error "You have an error in your SQL Syntax"?
Please help, I have been stuck for hours In my SQL database, CustomerID is an Int, Name, Time and Data are VARCHAR(45) and the price is a double(2,2)