"Missing operator" means exactly what it says! There is something missing. Perhaps data pulled from the db contains quotes and they are interpreted as operators in the sql query. Or you "spell" wrong the data types... I'm sorry I do not have the time to look to your code, it's realy too big to understand it and point you to the right syntax but:
a) check the data type and make sure that you spell them right
b) make sure you not pull out from the db quotes, paranthesis or blanks...
c) good luck
Edited by zaboss