The TDataset keeps an array of TFields. The fieldbyName does a linear search of this
array for a field of the specified name.
FieldByName returns a TField. If you look at TField - AsString etc is a property with
read and write methods.
To get the correct behaviour for each of the different field types, the getter and
setter methods for each property is virtual, so that descendants of TField can
implement the correct behaviour eg TNumericField, TStringField etc.
Myles.
-----Original Message-----
From: Jeremy Coulter [SMTP:[EMAIL PROTECTED]]
Sent: Tuesday, July 06, 1999 8:28 AM
To: Multiple recipients of list delphi
Subject: [DUG]: FieldByName
HI all.
I was wondering if anyone could explain how FieldByName works.
By that I mean HOW it works, i.e. how you can set data with it, i.e.
fieldbyname('name').asstring:='joe'; AND you can get data from it, i.e.
fieldbyname('Name').asstring.
So how do you create a property with this type of functionality ?
I would like to be able to include similar functionality into one of my components I
am working on at the moment.
I had a look in the DB.pas file, but was none the wiser.
Can anyone explain ?
Thanks, Jeremy Coulter
application/ms-tnef