Subject SQL error code = -104 Unexpected end of command, from Delphi App
Author
I looked through previous topics, and although this seems like a common error, I didn't find one quite like my situation.
I'm using a TIBCQuery in Delphi 2007. 
SQL.Text := 'Select * From AR ORDER BY DueDate, TransDate, PolNum;';
The error occurs when I issue an Insert, or Close command.
Actual Error: Dynamic SQL Error SQL error code = -104 Unexpected end of command - line 1, column 30

I have backed up and restored the database just in case it was some kind of corruption. The problem persisted after that. It is possible to display and edit data in an DevEx Express Grid. The problem only seems to exist when I try to Insert from Delphi.
Actual Delphi Code (qAR is the TIBCQuery):
  With DM.qAR do
  begin
    iCarrierNo := FieldByName('CarrierNo').AsInteger;
    sCarrier := FieldByName('Carrier').AsString;
    sInvoiceNo := FieldByName('InvoiceNo').AsString;
 
ShowMessage('1');
    Insert;
ShowMessage('2');
      {Duplicate AR field values}
      FieldByName('CarrierNo').AsInteger := iCarrierNo;
      FieldByName('Carrier').AsString := sCarrier;
      FieldByName('InvoiceNo').AsString :=  sInvoiceNo ;
and so on....
   
It gets as far as the Showmessage('1'), but does not reach Showmessage('2'). 


I hope I've given enough info for you to understand what's going on. I've tried what I know, which apparently isn't much.

Thanks in advance.