Board index » delphi » "Syntax Error in expression" strange error

"Syntax Error in expression" strange error

In my directory "c:\pietro\user" i have a table named "ORDINI.DB"
created with DataBase Desktop.
I have a form with a query component and a TField component.
I have wrote  this query:
        SELECT *
        FROM "C:\pietro\user\Ordini.Db"
        WHERE Ordini."Data Ordine" > :DataOrdineInizio
It's a dinamic query where "Data Ordine" is a field of the table.
Into the code of the form i have this istructions:
        on create event - QueryOrdini.Create;
        on onClik event - QueryOrdini.Close;
                          QueryOrdini.ParamByName('DataOrdineInizio').AsDate := 01/01/96;
                          QueryOrdini.Open;
where QueryOrdini is the name of my Query.
Always i have the error "Syntax Error in expression. Field : Data
Ordine. Table : c:\pietro\user\ordini.db: Image 2".

Help !!! Please answer at <tecn...@gefran.it>, if possible. Thanks.

 

Re:"Syntax Error in expression" strange error


In my directory "c:\pietro\user" i have a table named "ORDINI.DB"
created with DataBase Desktop.
I have a form with a query component and a TField component.
I have wrote  this query:
        SELECT *
        FROM "C:\pietro\user\Ordini.Db"
        WHERE Ordini."Data Ordine" > :DataOrdineInizio
It's a dinamic query where "Data Ordine" is a field of the table.
Into the code of the form i have this istructions:
        on create event - QueryOrdini.Create;
        on onClik event - QueryOrdini.Close;
                          QueryOrdini.ParamByName('DataOrdineInizio').AsDate := 01/01/96;
                          QueryOrdini.Open;
where QueryOrdini is the name of my Query.
Always i have the error "Syntax Error in expression. Field : Data
Ordine. Table : c:\pietro\user\ordini.db: Image 2".

Help !!! Please answer at <tecn...@gefran.it>, if possible. Thanks.

Re:"Syntax Error in expression" strange error


I believe your problem is related to the quotes you are using to specify
 the field name where you want to perform your selection criteria.  
Borland's SQL is reading it incorrectly.  I can't explain why you should
do what I am suggesting, but I know I had the problem, and make the
suggested correction to my code, and it worked.  If it doesn't work,
please let me know, either way.

Instead of
  SELECT *
         FROM "C:\pietro\user\Ordini.Db"
         WHERE Ordini."Data Ordine" > :DataOrdineInizio

Try
        SELECT *
        FROM "C:\pietro\user\Ordini.Db" d
        WHERE d."Data Ordine > :DataOrdineInizio

Other Threads