I created a VARCHAR(50) field in SQLite
, which maps to a TEXT field.
Using TFDQuery
to open the table, the TEXT field maps to a TWideMemoField.
I have set the DisplayValue
and DisplayWidth
of this TField
.
if oField is TWideMemoField then
begin
TWideMemoField(oField).DisplayValue := dvFull;
TWideMemoField(oField).DisplayWidth := 255;
end;
However, using FDQuery1.FieldByName(‘SOMENAME’).AsString still returns blank.
How do I get the above code to work? If it does not even give me the value using .AsString, naturally value does not appear in TListview.
Or is it better to use database mapping to map the field types? Not familiar with mapping, but I have something like:
with FFDQuery.FormatOptions do
begin
OwnMapRules := True;
with MapRules.Add do
begin
SourceDataType := dtMemo;
TargetDataType := dtAnsiString;
end;
with MapRules.Add do
begin
SourceDataType := dtWideMemo;
TargetDataType := dtWideString;
end;
end;
Should I try to solve it using (1) or (2)?