Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-27-2001, 06:37 PM
jdbarclay jdbarclay is offline
Junior Member
 
Join Date: Jan 2001
Posts: 12
Default (MEMO) in DBGrid

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)
Reply With Quote
  #2  
Old 03-27-2001, 11:02 PM
phear phear is offline
Senior Member
 
Join Date: Mar 2001
Posts: 325
Default RE: (MEMO) in DBGrid

you must change the type of the field in the query to TStringField instead of TmemoField or TBlobField.
Reply With Quote
  #3  
Old 03-30-2001, 05:49 PM
jdbarclay jdbarclay is offline
Junior Member
 
Join Date: Jan 2001
Posts: 12
Default RE: RE: (MEMO) in DBGrid

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
Reply With Quote
  #4  
Old 03-31-2001, 01:24 AM
phear phear is offline
Senior Member
 
Join Date: Mar 2001
Posts: 325
Default RE: RE: RE: (MEMO) in DBGrid

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:14 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.