Client Data Set - Wide Memo

Posted on 2013-06-12
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
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…

734 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