Data type mismatch when retrieving records from an access database using a DateTimePicker
- by Daniel
I get a Data type mismatch criteria expression error when i try to retrieve records from an access database between two dates using a DateTimePicker in C#.
This is the Select statement
else if (dtpDOBFrom.Value < dtpDOBTo.Value)
{
cmdSearch.CommandText = "SELECT [First Name], [Surname], [Contact Type], [Birthdate] FROM [Contacts] WHERE [Birthdate] >= '" + dtpDOBFrom.Value +"' AND [Birthdate] <= '" + dtpDOBTo.Value +"'";
}