SQLite3 DBGrid Data lazarus / 16-Databases ---------------------------------------------------------------------- eshjim · 2016-06-06 22:28 The Wiki Grids Reference page recommends that to avoid (MEMO) being displayed in DBGrid component string fields, a SELECT CAST expression should be used instead of  SELECT * FROM.  The example quoted is: 'SELECT cast(Name as TEXT) as Name FROM Client'.  Am I missing something here?  I can see that working for a single field, but consider a very simple database: Test.DB CUST_NO Integer CUSTOMER Text COUNTRY Text Running SELECT * FROM Test.DB shows the CUST_NO field correctly but the text fields as (MEMO). How would the recommended SELECT CAST statement be shown in this simple example in SQLite3 to show all records and fields? Any help gratefully received. ---------------------------------------------------------------------- Jurassic Pork · 2016-06-06 23:22 hello, what is the  max "size" in characters of your CUSTOMER and COUNTRY fields. In my Deadlymushrooms sqlite3 database ( lazarus\examples\database\image_mushrooms ) i use VARCHAR type for small strings and TEXT for big text : Quotecid      name                type        notnull      dflt_value      pk  ------- ------------------ ---------- ----------- -------------- --- 0        ID                  INTEGER     1                            1    1        Scientific_Name     VARCHAR     1                            0    2        Common_Name         VARCHAR     0                            0    3        Order               VARCHAR     0                            0    4        Genus               VARCHAR     0                            0    5        Notes               TEXT        0                            0    6        Picture             BLOB        0                            0    7        Image_Link          VARCHAR     0                            0  im my DbGrid , i can see the VARCHAR fields as strings and the TEXT field Notes as (MEMO) but i have a TDBMemo to display it. (see  first attachment) If i put   cast(Notes as VARCHAR) as Notes in my Query , i can see the field as string in the DBGrid (see second attachment). Friendly, J.P ---------------------------------------------------------------------- eshjim · 2016-06-07 09:34 Thanks for that JP.  Being new to SQLite and Lazarus, I was completely misled by some tutorials I was following which suggested that ordinary String fields were TEXT type when of course they are VARCHAR, the TEXT type being reserved for MEMO fields.  Lazarus is brilliant but in the old Delphi days working with the good old Borland Database Engine, we didn't have to worry about such technicalities!!