Subject Re: [IBO] TIBOQuery Datasource Property
Author Helen Borrie
At 04:52 AM 22/10/2006, you wrote:
>How can I use the TIBOQuery datasource property to set a parameter in
>my SQL?
>
>I thought that if I specified a datasource containing a field name
>that matched my parameter name that the parameter would be set, but
>that doesn't seem to be the case.

A datasource is a row-level mechanism that links a data access object
to one or more controls. Unfortunately, except for master-detail
linking, the VCL's datasource lacks the cleverness that enables you
to link a VCL data-aware control to a parameter.

>What else do I need to do?

I'm not aware of any facility in the TDataset/VCL mix that provides
automation for this. You have to use non-data-aware controls for the
parameters and do manually what the native IBO datalinking does
automatically. Read and validate the user entries in the NDAC's at
the BeforePost event and either assign the values to the params or
abort the DML operation to allow the user to fix problems.

This looks nicer on a form layout than on a grid; but even a
grid-driven interface doesn't look too bad if you lay out an external
"row" of TEdits and TDBEdits at the top or bottom of the grid and
make the grid read-only. Hook the dataset fields to the TDBEdits and
use the TEdits to accept values for parameters. You can use the
scroll event to clear the TEdits.

If this is related to your first question, then there is nothing to
stop you from setting up a input form that uses the native data
access (a TIB_DSQL, TIB_Datasource) and the native IBO controls, even
if you are using the TDataset-compatible stuff elsewhere.

Helen