Subject Re: [IBO] EDatabaseError: Field ‘ID’ not found in TClientDataSet and TIBOQuery
Author Helen Borrie
At 12:21 PM 11/09/2003 +0000, you wrote:

>In a simple form, I have a TClientDataSet connected to a TIBOQuery
>via TDataSetProvider.
>
>The SQL in TIBOQuery is only "SELECT COUNT(*) FROM TABLE1"
>
>When I call ClientDataSet.Open, the message "EDatabaseError:
>Field `ID' not found" appears. ID is the primary key of the TABLE1.
>This error is thrown in TIBODataSet.PSGetIndexDefs function. I
>suppose that IBO is trying find the index field but does not find it,
>but in fact, I think that is not necessary.

I think that is because the query does not return any database fields.


>I only want the number of registers via TClientDataSet because I
>cannot access to TIBOQuery directly.

I'm curious as to why not..but a dataset component is not wanted here.

The proper way to fire this query (a singleton with no database fields) is
with a TIB_DSQL. Check for Prepared and then call its Execute
method. Read MyQuery.Fields[0].AsInteger to get the result.

Helen