Subject RE: [firebird-support] RE: SQL error code = -104 Unexpected end of command, from Delphi App
Author

Thank you, Svein. I like the param idea. As you might be able to tell, this piece of the project is still under development. Now is a perfect time for me to switch to parameters.


I solved my problem late last night. It was not easy to isolate. I usually set break-points and step through the code, but the error was being generated at a point that was remote from where the problem was being created. Although the Delphi part is off-topic, I'll briefly describe what was happening in case it might help someone else who falls into the same trap I did.


I dynamically build a couple of "lookup" queries in the DevEx Quantum Grid's onFocusedRecordChanged event. It was not obvious that the event fired, and then a false event fired that returned empty values.


    'Select * from AR where PK_ID = ' + DM.qAR.FieldByName('PK_ID').AsString ;
was:   Select * from AR 'where PK_ID =  no value here


This resulted in the Unexpected end of command. It was exactly as Helen predicted -- of course. With one line of code, I rejected the false event. All is well with Firebird and Delphi (that four letter word). I usually use the onAfterScroll even for this kind of thing. This is my first attempt at using the grid's equivalent. I didn't expect the second false firing.


Thanks to all who offered help. I hope my experience can help someone in the future.