At 10:37 a.m. 9/01/2014, ho...@agencybusys.com wrote:

>I looked through previous topics, and although this seems like a common error, 
>I didn't find one quite like my situation.

You realise this is a problem with your Delphi client code, don't you?  And 
that this list is not a Delphi support list.


>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.

Insert and Close are Delphi methods.  So is Post which, in most data access 
components, should be called after the data for an Insert or Update operation 
has been assigned.


>Actual Error: Dynamic SQL Error SQL error code = -104 Unexpected end of 
>command - line 1, column 30

This is a Firebird exception, that occurs when client code issues an incomplete 
SQL statement, which can come about from mishandling of the single-quoting of 
strings.  You need an SQL monitoring tool or a Delphi debug tool to see what 
this invalid statement is.

>I have backed up and restored the database just in case it was some kind of 
>corruption. 

The error is occurring somewhere in your Delphi code.  A statement being issued 
to the server is terminating early because the parser got to "something" in a 
statement that prevented it from making sense of the whole thing. A very common 
cause is mishandling of the quoting of strings, most especially apostrophes.

>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;

// Protect against the occurrence of a name like O'Brien or Johnson's Removals:
                          sCarrier := QuotedStr(sCarrier);


>      FieldByName('Carrier').AsString := sCarrier;

Try the same with sInvoiceNo if there is any possibility that the string 
contains apostrophes.


>      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.

 Moderator Hat ON: This time it was sort-of OK to use this support list because 
you didn't seem to recognise that it wasn't a Firebird problem and you *did* 
get an exception from the database.  Don't make it a habit to use this list for 
Delphi problems, though. I don't know where TIBCQuery comes from but most 
third-party data access components have their own support lists.


Helen Borrie, Support Consultant, IBPhoenix (Pacific)
Author of "The Firebird Book" and "The Firebird Book Second Edition"
http://www.firebird-books.net
__________________________________________________________________ 

Reply via email to