Subject Re: [IBO] problems with SQL query
Author Helen Borrie
At 04:19 PM 29/07/2004 +0000, you wrote:
>--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> > > Params['empNo'].AsString := form1.DBEdit3.Text;
> > > but I get 'incompatible types: integer and string' on both the
> > > params lines.
>
> > This isn't an incompatibility coming from the databases, it's in the
> > values you are reading. AsString isn't incompatible with char types.
>
>TIB_Statement
>property Params: TIB_Row;
>
>TIB_Row
>property Columns[Index:word]: TIB_Column; default;
>
>so doing Params['string here'] doesn't work. (compile error)

Params['ParamName'] is valid in IBO. It resolves to the index number of
the Params[] array. ByName and ParamByName are both slower than referring
to the column index; but they are safer than the raw index number
(Params[n]) when you're not certain what the index is. The
Params['ColumnName'] fills that safety gap while avoiding the overhead of
ParamByName.

The exception reported wasn't a compiler error, it was a dataset exception.

If you are using the TDataset-compatible components, the Params object
surfaced is the VCL TParams. You'll get the compiler error in this case,
since the native IBO Params object is only available through InternalDataset.

You suggested:

> try Params.ByName('name of the column') or Params.ParamByName('...')

Either will work with native IBO, but note that the ParamByName() method
should be applied to the dataset, while the ByName() method applies only to
the to the ib_row object which, in this case, is a native IBO
aDataset.Params. ADataset.Params.ParamByName (one more level of
indirection) is there for compatibility.

In support questions, it's important to say what components one is
using...the native and compatible datasets have a lot in common, but there
are some differences that *really* matter.

hth

Helen