>How VFP is suppose to know that it's a comment?
By parsing the statement for that too, just like it parses for "?" :).
That would make it dangerous, actually, something that may be a part of a string may be construed as a comment, and anything beyond that point would be misinterpreted, and possible real mentions of a parameter would be lost. Also, SQL server has two ways of designating text as comment - others may have their own, and VFP is not in the business of knowing them all or being compatible with just a few. So it's actually better this way, with parser not trying to be smarter than it should.
I wrote this just because I forgot about it for the second time... so to weld it deeper into my memory, "do not embed question marks in comments in SQL in Fox".
>>
>>h=sqlstringconnect("your connect string here")
>>?sqlexec(h, "-- is this a proper comment?", "none")
>>
>>
>>You get a nice "SQL parameter is missing." error for this.
>>
>>Why? Because there's a question mark in the SQL command being sent, and VFP parses it, looking for parameters. Well, the parser isn't too smart - if it was, it would be writing SQL for us, right? - so it finds a question mark followed by nothing that would serve as a variable name, a-ha! Error.
>>
>>Just in case someone else bangs into this particular corner of the wall, may they escape without this ugly bump on the forehead.