Recent

Author Topic: Proper use of TDBF.Lookup  (Read 4526 times)

AlZuur

  • New Member
  • *
  • Posts: 11
Proper use of TDBF.Lookup
« on: September 06, 2010, 02:22:59 am »
How should I properly use TDBf.LookUp?

in the following:
  PersonId := Sender.AsInteger;
  PersonName := PersonDbf.Lookup('id', PersonId, 'firstname;lastname');
  aText := PersonName[0] + PersonName[1]; //which should result in 'firstname lastname'

I get a Access Violation or 'External:SIGSEGV' with dbg.
The person database has the fields id, firstname and lastname and there is a record with the provided person id.
I am in doubt about my use of the lookup method, but I can't find an example of its proper use anywhere, and if I look in the code of the method then my use should be more or less correct.
What am I doing wrong in these lines?

AlZuur

  • New Member
  • *
  • Posts: 11
Re: Proper use of TDBF.Lookup
« Reply #1 on: September 07, 2010, 02:27:59 am »
Sorry for that. After a good night sleep, it turned out that I had the
Code: [Select]
PersonDbf := TDbf.Create(nil) in the wrong place  :-[. The code in my original post works quite well, thank you.

Regards.

 

TinyPortal © 2005-2018