Page 1 of 1

'Field X not found.' bug

Posted: Mon 24 Jan 2005 13:24
by Bagieta
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)

Posted: Tue 25 Jan 2005 08:56
by Alex
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;

Another problem

Posted: Tue 08 Mar 2005 09:27
by Bagieta
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

Posted: Wed 09 Mar 2005 15:45
by Alex
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.

Posted: Fri 11 Mar 2005 10:42
by Bagieta
Ok I have downloaded the newest version and there is no problem. So there was no question.
Thanks.