I created a database in ms access, in the database I have a table with two columns, fist column is Name with Text data type, and the other column is Date with Date/time data type. and I want to insert values in the table, but it give this error for the month calendar
Data type mismatch in criteria expression.
string sqlQuery = "INSERT INTO register (`Name`,`Date`) values (?,?)";
using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\DB.accdb"))
using (OleDbCommand cmd = new OleDbCommand(sqlQuery, conn))
{
conn.Open();
cmd.Parameters.AddWithValue("@Name", this.textBox1.Text);
cmd.Parameters.AddWithValue("@Date", this.monthCalendar1.Text);
cmd.ExecuteNonQuery();
}