[Lazarus] Master-detail problem

Koenraad Lelong lazarus1 at de-brouwerij.be
Fri Apr 6 14:31:02 CEST 2012


On 29-03-12 17:22, Michael Van Canneyt wrote:
>
>
> On Thu, 29 Mar 2012, Koenraad Lelong wrote:
>
>> Hi,
>>
>> I made a application using a master-detail construction.
>> I want to have the detail table follow a master-field, and I want to
>> specify another condition for the detail. This seems not to work. I
>> get an error stating the master-table does not contain a field with
>> the name of my manual parameter.
>> SQL of master :
>> select worker_number, worker_name
>> from worker_table
>>
>> SQL of detail :
>> select *
>> from work_table
>> where worker_number=:worker_number
>> and work_date between :from_date and :to_date
>>
>> When I try to open my master-table I get an error : field :from_date
>> not found in table sqlWorker (=the name of the TSQLquery of the
>> master-table).
>>
>> When I remove the between clause, everyting is OK.
>>
>> What am I doing wrong ?
>
> You must set the value of the :from_date and :to_date in code in the
> BeforeOpen event.
> If datasource is set, then ALL values of all unbound parameters are set
> in the Open event.
> Setting the parameter 'binds' it, and then it's value will no longer be
> fetched from the datasource.
>
> Michael.

Hi,

I submitted a bug-report, with a demo program : 
http://bugs.freepascal.org/view.php?id=21660

I filled in the parameters before opening the table, but not in the 
BeforeOpen event.
If I'm still doing something wrong, please explain.

Thanks,

Koenraad Lelong.




More information about the Lazarus mailing list