'Field X not found.' bug

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Bagieta
Posts: 21
Joined: Tue 09 Nov 2004 08:02
Location: Poland

'Field X not found.' bug

Post by Bagieta » Mon 24 Jan 2005 13:24

Hi there.
There is a bug in ODAC or CRDBGrid control (I think it is in TCRDBGrid).

It happens when I exec query with 'order by' clause with two identical names and then I start another query without order by clause.

Here is the example:

Code: Select all

select * from dbversion d 
order by date, d.date
ant after execution I execute another query
f.ex.:

Code: Select all

select * from emp
Then I got the error 'Field date not found.'

In the example there is no need to use such a stupid order by that I have made but it is just a simplification because this bug also happens when I use more than one table (that have the same field name - which I use in order by)

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Tue 25 Jan 2005 08:56

In your case you can set CRDBGrid1.OptionsEx.dgeLocalSorting to false in object inspector or execute the next command at run-time:

Code: Select all

CRDBGrid1.OptionsEx := CRDBGrid1.OptionsEx - [dgeLocalSorting];
after that sorting will be performed on the server side and you avoid error appearance.
But the common thing to do is to set IndexFieldNames := '' of linked DataSet object after changing SQL property, for example:

Code: Select all

OraQuery1.Close;
OraQuery1.SQL.Text := 'Select * from emp order by hiredate';
OraQuery1.IndexFieldNames := '';
OraQuery1.Open;

Bagieta
Posts: 21
Joined: Tue 09 Nov 2004 08:02
Location: Poland

Another problem

Post by Bagieta » Tue 08 Mar 2005 09:27

I have used the second approach with setting IndexFieldNames and it has resolved described error.
But I got another error connected to IndexFieldNames:

"Invalid IndexFieldNames format!"

This error occurs when the column has no name

select column1, null
from Table
order by 1, 2

and try to call it twice.

another example

select column1, 1
from Table
order by 1, 2


another

select column1, 'TEST'
from Table
order by 1, 2

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Wed 09 Mar 2005 15:45

We couldn't reproduce your problem, pls. specify your ODAC version and send us small demo project with script to create server objects to ODAC support address.

Bagieta
Posts: 21
Joined: Tue 09 Nov 2004 08:02
Location: Poland

Post by Bagieta » Fri 11 Mar 2005 10:42

Ok I have downloaded the newest version and there is no problem. So there was no question.
Thanks.

Post Reply