I have in my Ms-Access database table, a date field in Short Date format.
I have in my C# program DateTimePicker control in dd/MM/yyyy short date format
I try to insert data using C# code like this:
SQL = "insert into MyTbl(D_from,D_to) values (@MyFrom,@MyTo)";
OleDbCommand Cmd = Conn.CreateCommand();
OleDbParameter dateparam1 = Cmd.Parameters.AddWithValue("@MyFrom", DbType.DateTime);
dateparam1.Value = dt_From.Value;
OleDbParameter dateparam2 = Cmd.Parameters.AddWithValue("@MyTo", DbType.DateTime);
dateparam2.Value = dt_To.Value;
Cmd.CommandText = SQL;
Cmd.ExecuteNonQuery();
and I got the error: Data type mismatch in criteria expression.