Subject Re: [IBO] Unable to access database fields in my source code
Author Helen Borrie (TeamIBO)
At 05:22 AM 29-01-02 -0800, you wrote:
>I am new to IBObjects so I bought the Getting Started
>help and it has been very informative but there are
>three questions that I am unable to find an answer
>1) The data aware fields link to the database fields
>OK but I am unable to access any database fields in
>the code. eg:
> ADM.qAccount.FieldByName('Desc').AsString := 'Test';
> ADM.qAccount['Desc'] := 'Test';
>Both respond with the runtime error
>"Test.exe raised exception class EIB_Statement error
>with message Fieldname: Desc not found process
>What am I doing wrong?

Are you using native IBO components (TIB_*) or the TDataset-descendants (TIBO*?

Is Desc an actual database column? or is it a calculated field, computed by or subselected column? (It would help if you would show us the SQL statement..)

Are you using a database created with one of the tools that forces all identifiers into double quotes? (This makes identifiers case-sensitive so, if the column is named "DESC" then "Desc" won't find it).

>2) How do you obtain the field type from Interbase eg
>if ADM.TranType.FieldByName('Account').Datatype = ....

Read the SQLType property of the Field or Parameter object. It returns a SmallInt. You'll find all the constant declarations for the types towards the end of IB_Header.pas.

>3)How do you obtain the Domain names from Interbase

Depending on what you want, you can query the system tables. For an example, look at the code in IB_SQL...A Schema Cache will also give you access to a list of domain names.

For a particular column in a dataset you read its DomainName property (pretty costly, as it has to query the system tables to get it).

Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at