>> I do it:
>> procedure TForm1.FormCreate(Sender: TObject);
>> begin
>>   with DatasetSales do
>>   begin
>>   Open;
>>   DatasetItems.Open;
>>   FieldByName('Item').FieldKind := fkLookup;
>>   FieldByName('Item').LookupDataSet := DatasetItems;
>>   FieldByName('Item').LookupKeyFields := 'Code; Description';
>>   FieldByName('Item').LookupResultField := 'Code';
>>   end;
>> end;

1) You forgot to set KeyFields
  (or, rather, FieldName -- it should be different form KeyFields or
DBGrid might be confused)
2) You probably mixed up LookupKeyFields with LookupResultField
3) If you want the lookup field to be editable, you will need
to use Lazarus version later then http://bugs.freepascal.org/view.php?id=12347
and to set LookupCache := true
4) Even after this, there is some problems in SQLdb which I did not
yet found time
to diagnose and fix properly. They cause AVs while scrolling DBGrid.

On Thu, Dec 25, 2008 at 12:08, Luiz Americo Pereira Camara
<luiz...@oi.com.br> wrote:
> It's not implemented in TSqlite3Dataset. In fact i don't know in which
> layer (TDataset / TDataset descendant / TDbGrid) should be implemented.
>
> It's up to TDataset descendants implement this?
>
> Does some descendant already implemented ?

It seems to be implemented in SQLdb (TBufDataset).
So, in addition to the above, original poster should indeed drop sqlitedataset.
Perhaps TSQLite3Connection can be ised instead?

-- 
Alexander S. Klenin
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to