I keep getting a 'data type mismatch in criteria expression' when trying to insert into my Access 2010 table. The table has field names of: GradeKey - AutoNumber, Grade - Text, Comments - Text, TellerNum - Number, TestName - Text. The TestName is also a foreign key from another table. Any ideas on what I need to use to fix the data type mismatch?
using (OleDbConnection con = new OleDbConnection(constring)) { try { string cmdstring = "INSERT INTO GRADE (Grade, Comments, TellerNum, TestName) VALUES (@grade, @comments, @teller, @test)"; using (OleDbCommand cmd = new OleDbCommand(cmdstring, con)) { cmd.Parameters.AddWithValue("@teller", OleDbType.Integer).Value = comboBox5.Text; cmd.Parameters.AddWithValue("@grade", OleDbType.Char).Value = textBox7.Text; cmd.Parameters.AddWithValue("@comments", OleDbType.Char).Value = textBox10.Text; cmd.Parameters.AddWithValue("@test", OleDbType.Char).Value = comboBox16.Text; con.Open(); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Submitted Successfully"); } } catch (Exception ex) { MessageBox.Show("Failed due to " + ex.Message); } }