Memo and DBGrid

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
AlainANTOCI
Posts: 21
Joined: Wed 07 Apr 2021 07:48

Memo and DBGrid

Post by AlainANTOCI » Thu 17 Mar 2022 13:00

Hi,

I use some DBGrid to show memos field.

If I done this :
SELECT CAST(SUBSTR(My_memo,0,255) AS VARCHAR2(255)) AS My_Memo_txt FROM My_table

It works with TUniQuery but with TVirtualQuery the only thing I have in my DBGrid is '(memo)'.

Is there anything to do with VirtualQuery, for now I use calculated field but if you have another solution.

Regards

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Memo and DBGrid

Post by MaximG » Thu 17 Mar 2022 13:27

VirtualQuery is built using the SQLite engine. When the SQLite engine cannot determine the type of the field returned by the query, we create the corresponding Field of the Memo type. In order for such fields to be created with the type required by a developer, you can use DataTypeMapping, a special mechanism provided by our components. You can use this feature both in Design Time with the help of VirtulalQuery Editor, and in Run Time:

VirtualQuery.DataTypeMap.AddFieldNameRule ('My_Memo_txt', ftString, 255);

AlainANTOCI
Posts: 21
Joined: Wed 07 Apr 2021 07:48

Re: Memo and DBGrid

Post by AlainANTOCI » Thu 17 Mar 2022 16:39

Nice !!

It work fine.

Post Reply