as

Wednesday 26 February 2014

data type mismatch in criteria expression in ms access

Problem / Error:

When you try to access the data from the Microsoft Access database from any language like C#, VB.Net, VB6 etc, You may encounter the error saying - data type mismatch in criteria expression .
This happens when you are executing the query involving the column with data type set as Date/Time in access database.

For example -Consider below query.

Select * from student where joining_date = '12-01-2013' 

Executing above query will give you the error saying data type mismatch in criteria expression.

Solution:
To fix above issue, you will have to re-write the query as mentioned below.

Select * from student where joining_date = #12-01-2013#

Thus we have to use # at the start and end of the date value. This will fix the issue.


What do you think on this topic? Please express your opinion through comment below. You can write to me at reply2sagar@gmail.com

Sponsored Links

Popular Posts

Comments

ShareThis