I've had this issue before when handwriting SQL queries in combination with Dapper and MS Access when the query has multiple parameters. The problem is that the access engine doesn't respect parameter order and sorts them alphabetically.
Take for example this sample table named MyTable:
MyNumber Number
MyDate Date/Time
Assuming you had a C# class MyClass:
public class MyClass
{
public int MyNumber { get; set; }
public DateTime MyDate { get; set; }
}
And had an instance myClass that you passed into the following Dapper statement:
connection.Execute("INSERT INTO MyTable (MyNumber, MyDate) VALUES (@MyNumber, @MyDate)", myClass);
The statement would fail due to System.Data.OleDb.OleDbException: 'Data type mismatch in criteria expression.'
This is because Access will sort the parameters alphabetically, which in this case causes it to try to stick a number into a date and a date into a number.
You can workaround this by naming your parameters in an alphabetically-friendly manner, or ordering them alphabetically. In this case the above statement could be rewritten as:
connection.Execute("INSERT INTO MyTable (MyDate, MyNumber) VALUES (@MyDate, @MyNumber)", myClass);