Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Client Data Set - Wide Memo

Posted on 2013-06-12
Medium Priority
Last Modified: 2013-06-28
Greek Extended characters do not "stick" in Delphi MIDAS wide memo field.

I can enter them into a wide memo, but when the field is saved to the TClientDataSet and then read again, it comes back as "?"

I can work around this by writing the memo as a fixed length wide string (with a substitute new line character), but this loses the flexibility of the memo type, which allows many lines, entirely at the user discretion.

Here is the code used to save the field:


Where cdsDiction is a TClientDataSet and the associated data field "WideMeaning" is a Wide Memo, and the VCL field "Meaning" is a TMemo.
Question by:GrahamDLovell
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 21

Expert Comment

ID: 39246256
Is this in a stand alone client dataset or is it being used along with a database table or query?  If it is, which database?

What version of Delphi are you on?  If it is on a version that handles unicode characters then you should be able to simply use AsString to assign the value.

If you are on a version prior to the use of unicode strings I can tell you that you are missing out on some amazing tools...

Author Comment

ID: 39246331
It is a stand alone client dataset, saving to .cds file. However, the problem occurs before the save, in any case.

I am on the latest Delphi, XE4. Yes, I agree it has a great set of tools. That is why I am so surprised it isn't working. However, it could be that I am just making a simple mistake. That is why I included the code, which is also simple.

One of the values it doesn't appear to store properly is the unicode represented by ή. This is OK in the TMemo on input, but it gets replaced with ? if I just do next and then previous on the TDataSet

For a Memo field, I have only been able to use assign. Of course, if I use a simple AsString property I get an incompatibility of TString and string error:

    cdsDiction.FieldByName('WideMeaning').AsString := meaning.Lines;

I am not aware of any way to iterate through the TDataSet widememo field instead of making an assignment.

Accepted Solution

GrahamDLovell earned 0 total points
ID: 39265716
Here is my fix for my problem:

I do not now try to directly assign a ClientDataSet WideMemo field to a TMemo. For preference, I put a TDBMemo on the form and link the TDBMemo field to the ClientDataSet via a TDataSource.

Where I also needed a Memo field on the form that is not actually linked to the TClientDataSet, I had to include some extra steps.

1. I put a TDBMemo field on the form, as above, but hid it so that the user won't to see it (e.g. naming it DBMemo).
2. I put a TMemo field on the form (e.g. naming it Memo).
3. For when I move a new row, I include the following code
  for k := 0 to DBMemo.Lines.Count-1 do
    Memo.Lines[k] := DBMemo.Lines[k];
4. For when I make changes to the Memo field, I include the following code
  for k := 0 to Memo.Lines.Count-1 do
    DBMemo.Lines[k] := Memo.Lines[k];

When converting an existing ClientDataSet Memo field to WideMemo it was necessary to use a version of the above code. (I didn't originally do that, and it has given me much grief.)

There may be a more elegant way of doing it, but this works.

Author Closing Comment

ID: 39283791
Problem solved, even though there could be a "less fussy" way of solving it that I have not found. Therefore = "good".

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this article, we’ll look at how to deploy ProxySQL.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA:…

671 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question