Note to self: Do not use double quotes around field names

 Delphi  Comments Off on Note to self: Do not use double quotes around field names
Dec 222014
 

Note to self:

If MS Access adds double quotes to field names in queries, do not use them!
It won’t complain about them (You’d wish it would), but it just won’t work.

So if you see something like:

SELECT *
FROM t_Mst_Tageserfassung
WHERE ("TeMitarbeiter"=92)  AND ("TeArbeitstag"=#12/24/2014#);

Remove the quotes and it will start to work as expected.

If you need to ensure that the fields are treated as field names, put them into parentheses like this:

SELECT *
FROM t_Mst_Tageserfassung
WHERE ((TeMitarbeiter)=92)  AND ((TeArbeitstag)=#12/24/2014#);

This also works with TAdoQuery in Delphi.

 Posted by on 2014-12-22 at 18:08