i am trying to add data to my ms access database I watch almost all yt tutorials but its still gives me an error on run time
private void btn_add_Click(object sender, EventArgs e)
{
try
{
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into Employee(Employee ID, Firstname, Lastname, Email, Username, Password)values('" + txt_employee_id.Text + "','" + txt_employee_firstname.Text + "','"
+ txt_employee_lastname.Text + "','" + txt_employee_email.Text + "','" + txt_employee_username.Text + "','" + txt_employee_password.Text + "')";
cmd.ExecuteNonQuery();
MessageBox.Show("Record Save", "Access Connected", MessageBoxButtons.OK, MessageBoxIcon.Information);
conn.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Access Connected", MessageBoxButtons.OK, MessageBoxIcon.Information);
conn.Close();
}
}