[Lazarus] SQLite & DB Aware Components
Martin Collins
mailinglists at collins-email.co.uk
Thu Dec 1 21:40:10 CET 2016
On 01/12/16 16:15, Martin Collins via Lazarus wrote:
> From what I understand, SQLite TEXT type has no set length so db aware
> components treat it as a memo. Therefore when I assign a TEXT field to a
> db aware component, all that appears in the component is "(MEMO)", even
> though most of my TEXT fields are only up to 10-30 characters long.
> Solutions offered on-line suggest using a dbmemo (which I have for my
> longer TEXT fields as that's what I want), but I need to use dbgrids,
> dbedits, dbcomboboxs, etc for the shorter TEXT fields.
>
I have found a solution to my problem, with thanks to the following link:
http://www.tweaking4all.com/software-development/lazarus-development/lazarus-pascal-getting-started-with-sqlite/#ATEXTfieldshowsamemoinaDBGrid
The answer was altering my SQL Query text, from something like this:
SELECT
"Filename",
"Date"
FROM
"mytable";
to this:
SELECT
CAST( "Filename" AS VARCHAR) AS "Filename",
"Date"
FROM
"mytable";
Casting it as a different type in the SQL statement worked! My bad and
inexperience with databases!
Hope this will help someone else one day! :-)
Thanks & best regards,
Martin
More information about the Lazarus
mailing list