Hi,
Using SQLite3, Lazarus 1.6.2 & FPC 3.0.0 on Peppermint Linux 7.
I have a small problem when using the db aware components & sqlite. After countless googling I understand why the components do this but can not find a simple solution! (BTW I this is my first time working with DBs & SQLite seemed the simplest and meets my needs (embeddable)).
My problem is described below, but I'll ask my questions first:
1. Are there any tricks anybody knows of so I can show the text via code in lazarus, or
2. Are there any tricks anybody knows of so I can show the text by altering the sqlite database (other than switching to another database entirely)?
As this affects all db aware components, it's probably something fundamental I am missing if it exists at all.
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 found a solution for dbgrids, using the dbgridpreparecanvas event, but not for the other db aware component types.
I can extract the text, using:
DataSource.DataSet.FieldByName('field').AsString
and I could use that to manually write the values to non db aware components as needed, but that seems a waste when we have these superb db aware components to use.
For information, I am coupling the data to the components simply by assigning the datasource & datafield to the db aware component. I'm using SQLite3Connection (as opposed to SQLite3Dataset), SQLQuery, SQLTransaction & DataSource.
Thanks for your help.
Martin
