View Full Version : (MEMO) in DBGrid
jdbarclay
03-27-2001, 05:37 PM
Does anybody know how to avoid appearing (MEMO) instead of the string value in DBGrids?
This happends when I join two fields in the SQL statement in the TQuery, for example:
name & ' ' & lastname (for access databases)
...this appears in the grid just as (MEMO)
phear
03-27-2001, 10:02 PM
you must change the type of the field in the query to TStringField instead of TmemoField or TBlobField.
jdbarclay
03-30-2001, 04:49 PM
Thanks I've tried that but when I open the query it gives me an error saying "Type mismatch for field..."
This happens when I use 'select (name & lastname)as fullname from...', the query returns that field(fullname) as a TMemofield and then it is impossible to change it to TStringField.
Hope you can help me
phear
03-31-2001, 12:24 AM
there are two ways of avoiding this, the first one is to make a CAST in SQL to return the field to the type you want : CAST is an SQL Server function, check if it's available in your database.
the second way : remove all fields from field editor and re-add all fields -> delphi gets all the fields with the correct types. if you still have a (MEMO) in your grid, it comes from the fact that the type of that field is not meant to be displayed in a DBGrid : TMemoField has line breaks so it's not meant to be displayed in the cell of a DBGrid. use TDBMemo instead or change the type of your field in your database.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.