As pointed out you're comparing month against year and so on. Also two hints for using the database:
- use proper datatypes in the datanase. Don't split the date to
varchar
columns, use
date
type in the table instead.
- use parameters in your queries. For more info see:
SqlParameter[
^].