I am a newbie and currently having problems with this part of my code where i get a syntax error after clicking the button to be recorded in the database.
private void button1_Click(object sender, EventArgs e)
{
FlightConn.Open();
oleDbCmd.Connection = FlightConn;
oleDbCmd.CommandText = "insert into tbl_flight (fld_PassengerName, fld_destination, fld_class, fld_date, fld_time) ('" +
this.textBox1.Text + "', '" + this.textBox2.Text + "', '" + this.comboBox1.SelectedItem + "', '" + this.comboBox2.SelectedItem + "','" + this.dateTimePicker1.Value + "');";
int temp = oleDbCmd.ExecuteNonQuery();
if (temp > 0)
{
textBox1.Text = null;
textBox2.Text = null;
comboBox1.Text = null;
comboBox2.Text = null;
dateTimePicker1.Text = null;
MessageBox.Show("Record Successfully Added");
}
else
{
MessageBox.Show("Record Failed to Add");
}
FlightConn.Close();
}
any ideas what the problem is? thank you for any future answers
VALUESkeyword in thatINSERTstatement?