I'm going to put two pieces of advice, and then I think I'm out.


1) Parameters. Let me say that again: Parameters... Parameters are your friend and should be used, especially in complex stuff like this. Odds are, youi're trying to store some "text" that has a tick mark ( ' ) in it... which then ends the string in your SQL ... and after that, everything goes to ____ ... plus it opens you up to injection attacks... it's known as the Little Bobby Tables problem... you do NOT want that.
2) There is no reason what so ever for everything to be a string/text... numbers are number, dates are dates, booleans are booleans ... treat them with the respect they deserve and store them properly. Between storing thigns properly as they should be and parameters, it reduces the things that can go wrong.

-tg