Need help on retreiving dynamic tClientDataSet values


2007-01-13 06:44:55 AM
delphi231
At runtime we create the follow dataset:
// Set up the static LOV in memory datasets here
// Gender LOV
FRIA0033dm.cdsGenderLov.FieldDefs.Add('Code', ftString, 1, False);
FRIA0033dm.cdsGenderLov.FieldDefs.Add('Description', ftString, 7,
False);
FRIA0033dm.cdsGenderLov.CreateDataset;
FRIA0033dm.cdsGenderLov.Open;
FRIA0033dm.cdsGenderLov.Append;
FRIA0033dm.cdsGenderLov.FieldByName('Code').AsString := 'M';
FRIA0033dm.cdsGenderLov.FieldByName('Description').AsString :=
'Male';
FRIA0033dm.cdsGenderLov.Post;
FRIA0033dm.cdsGenderLov.Append;
FRIA0033dm.cdsGenderLov.FieldByName('Code').AsString := 'U';
FRIA0033dm.cdsGenderLov.FieldByName('Description').AsString :=
'Unknown';
FRIA0033dm.cdsGenderLov.Post;
FRIA0033dm.cdsGenderLov.Append;
FRIA0033dm.cdsGenderLov.FieldByName('Code').AsString := 'F';
FRIA0033dm.cdsGenderLov.FieldByName('Description').AsString :=
'Female';
FRIA0033dm.cdsGenderLov.Post;
FRIA0033dm.cdsGenderLov.IndexFieldNames := 'Code';
dblucbGender.KeyField := 'Code';
dblucbGender.ListField := 'Code;Description';
// End of Gender LOV
We need to query this in memory table to populate a string field on a
Delphi 7 form. We are thinking of using the lookup method but it is a
variant and the examples return more than one value. We already point a
TDbLookupComboBox at the dataset and it works just fine. But we also
need to populate another text field from the OnExit event from the
LUCB. We just need to query on code and return description. Can we do a
tQuery against a tClientDataSet in memory?
Thanks.
Bruce