Applies to
TQDB, TQDBItem, TQDBView
Declaration
property ItemsByKey[Key : TKey] : string;
Description
The ItemsByKey array property offers access by key to the items of a QDB file as Delphi strings, e.g.:
ShowMessage(Q.ItemsByKey['Marsh']);
Or, since ItemsByKey is the default array property,
ShowMessage(Q['Marsh']);
When assigning an item to this property if the key doesn't already exist the item is added. Otherwise the item is changed. When reading the value of this property if the key doesn't exist a EQDBBadKey exception is raised.
Since Delphi strings can contain any characters (even nulls) they can be used to hold any kind of item:
bmp:=TFileStream.Create('test.bmp',fmOpenReadWrite);
SetString(s,bmp.Size);
bmp.Read(s[1],Length(s));
Q['bmp']:=s;
This technique is of limited use in D16 because of the 255 character limit on strings.
See also CurrentItem and Items
Run-time only