SQLite Provider / Memo
SQLite Provider / Memo
I have connected a TDBLookupComboBox to a TUniQuery object connected to an TUniConnection using the SQLite provider. I am attempting to show a field called "Name" of type TEXT as a lookup field in the TDBLookupComboBox, but the lookup field is displayed as "(Memo)" instead of the field's contents. I suspect the TDBLookupComboBox thinks the field is a CLOB since SQLite doesn't differentiate between text and a CLOB ... and hence the "(Memo)" text.
If I use a memory table and have the Name field defined as String, it works as expected.
Any suggestions for a way around this would be appreciated.
I'm using the 2.70.0.9 UniDAC demo with Delphi 2009 Pro.
If I use a memory table and have the Name field defined as String, it works as expected.
Any suggestions for a way around this would be appreciated.
I'm using the 2.70.0.9 UniDAC demo with Delphi 2009 Pro.
More Info. - Workaround
I was able to get the following to work to obtain a lookup value:
By casting the Name field (defined as TEXT in SQLite) as a VarChar in SQL, it will display properly in the TDBLookupComboBox. But this is not ideal ... anyone else have some ideas?
Code: Select all
SELECT ID, CAST(Name AS VarChar(255)) AS Name
FROM MyTableI don't understand what you mean by "change data type of the field in the database" - what can you change to from TEXT?Plash wrote:UniDAC always maps TEXT to TMemoField. You need to change data type of the field in the database or use any expression with this field in your SELECT query.
Regards,
Steve F
Hello,
As the TEXT field contains text data, you can change the type of this field to, for example, VARCHAR in the following way:
As the TEXT field contains text data, you can change the type of this field to, for example, VARCHAR in the following way:
Code: Select all
CREATE TABLE t1(id integer,txt text);
.....
INSERT INTO t1................
....
CREATE TEMPORARY TABLE t1_backup(id integer,txt varchar(255));
INSERT INTO t1_backup SELECT id,txt FROM t1;
DROP TABLE t1;
CREATE TABLE t1(id integer,txt varchar(255));
INSERT INTO t1 SELECT id,txt FROM t1_backup;
DROP TABLE t1_backup;In the SQLite database I had a VARCHAR(255) field, when adding a TUniTable / TUniQuery component and click on 'Add all fields', it added the field as TWideStringField, which is correct.
However, when I increased the length of the field in the database from 255 to 4096, then when creating the fields again in the UniTable / UniQuery components, it creates the field as TMemoField.
Why is this happening and how can this be resolved? I need the fields to be string type and not memo.
However, when I increased the length of the field in the database from 255 to 4096, then when creating the fields again in the UniTable / UniQuery components, it creates the field as TMemoField.
Why is this happening and how can this be resolved? I need the fields to be string type and not memo.