Board index » delphi » TMemoField: DataSize and GetData

TMemoField: DataSize and GetData

I've got a Paradox 5.0 table and persistent fields in my code.  When I
try to access DataSize of the MemoField, it returns 0, and GetData does
not work either.

MyTMemoField.DataSize always returns 0.

I managed to get around that by saving the MemoField to a TMemoryStream
and then using .Memory to get the text of the Memo in a Pchar, but this
is not beautiful.

Would anyone know why the DataSize and GetData do not work on a simple
not empty MemoField ?

Many Thanks for any answer.

 

Re:TMemoField: DataSize and GetData


Quote
Guy (gpige...@powerup.com.au) wrote:

: Would anyone know why the DataSize and GetData do not work on a simple
: not empty MemoField ?
Feature documented but not implemented error.

But you already found the solution which goes via Streams, although it is
not the nicest one it at least works. The normal way is to use a BlobStream
(I've a short code for that, just email me if you want it), but as got it
running with a MemoryStream you could just leave it as it is.

Bye,
   Andy

--
----------------------------------------------------------------------------
Andreas H"orstemeier                       | "We are not interested in
email: hoer...@hal1.physik.uni-dortmund.de | little green men, but in little
       a...@farpoint.sauerland.de          | green women."
fido:     2:2444/4505.3                    | (Edwin "Buzz" Aldrin)
astronet: 122:490/1.53                     |
----------------------------------------------------------------------------  

Re:TMemoField: DataSize and GetData


On 9 Feb 1996 04:02:24 GMT, gpige...@powerup.com.au (Guy) wrote:

Quote
>I've got a Paradox 5.0 table and persistent fields in my code.  When I
>try to access DataSize of the MemoField, it returns 0, and GetData does
>not work either.

>MyTMemoField.DataSize always returns 0.

>I managed to get around that by saving the MemoField to a TMemoryStream
>and then using .Memory to get the text of the Memo in a Pchar, but this
>is not beautiful.

>Would anyone know why the DataSize and GetData do not work on a simple
>not empty MemoField ?

The on-line help is in error. The GetData and SetData methods and the
DataSize property all work for simple data type components (such as the
TStringField component), but do not work with the complex components like
TMemoField and TBlobField.

For these complex component types, the designed means to read data from or
write data to a memo or BLOB field is with a TBlobStream object. For these
purposes, it has a Read and a Write method. It also has a Size property for
determining the size of the contents of the field.

**************************************************************************
Steve Koterski                    "Knowledge advances by steps, and not by
Product Group Manager             leaps."
Delphi Technical Support                       -- Lord Macaulay, 1800-1859
Borland International, Inc.

Re:TMemoField: DataSize and GetData


Quote
>Andreas Hoerstemeier wrote:
> Feature documented but not implemented error.Andreas,

How do you know?

*scream*
I tried to make it works for hours.
I even just posted a message about it.

Regards,
Rapha?l.

Other Threads