Page 1 of 1

Memo and DBGrid

Posted: Thu 17 Mar 2022 13:00
by AlainANTOCI
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

Re: Memo and DBGrid

Posted: Thu 17 Mar 2022 13:27
by MaximG
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);

Re: Memo and DBGrid

Posted: Thu 17 Mar 2022 16:39
by AlainANTOCI
Nice !!

It work fine.