Subject Re: Mounting fields inside TIBOQuery
Author Mauro Rocha
Ops... now I saw that this is due to a change in Delphi, not in IBO. Already figured it out.

Thanks.

On Wed, Jan 7, 2015 at 4:25 PM, Mauro Rocha <mnrocha.ufv@...> wrote:
Sorry, I didn't say the version I used: 4.9.14_b60.


On Wed, Jan 7, 2015 at 4:02 PM, Mauro Rocha <mnrocha.ufv@...> wrote:
Hello.

In version 4.8, I would use the following code to set a query and mount its fields for use inside a Dataset grid (not using IBObjects grid):

  Query1.SQL.Text := 'select ... from ... where ...';
  Query1.Fields.Clear;

  // add existing fields
  Query1.FieldDefs.Update;
  for i := 0 to Query1.FieldDefs.Count - 1 do
    Query1.FieldDefs[i].CreateField( Query1 );

  // add calculated field
  ...

Now when I run this code, the "for" loop raises an error for duplicated field. Has this behaviour changed? How can I fix it?

Best regards.

Mauro.