Board index » delphi » How can I assign a large string to a memo field

How can I assign a large string to a memo field

How can I assign a large string (ie 500 characters) to a memo field.
The following works if chunk is less than 255 characters.

DataB.QGeneral.FieldByName('Data').AsString := Chunk;

where 'Chunk' is a string < 255 characters
and 'Data' is a memo field in a paradox database.

I understand that it is possible to assign text contained in a TMemo
control to a memo field, ie:
DataB.QGeneral.FieldByName('Data').Assign(Memo1.Lines);

but the text I want to store is not in a TMemo control, it is contained
in a string passed in from 'the outside world'.  I need a way to assign
this string to the memo field.

If anyone can help I would be most apreciative,

Mike
m...@wds.co.nz

 

Re:How can I assign a large string to a memo field


Quote
Mike Thompson wrote:

> How can I assign a large string (ie 500 characters) to a memo field.
> The following works if chunk is less than 255 characters.

> DataB.QGeneral.FieldByName('Data').AsString := Chunk;

> where 'Chunk' is a string < 255 characters
> and 'Data' is a memo field in a paradox database.

DataB.QGeneral.FieldByName('Data').Lines.Text := Chunk

should do the work.
If there is again the 255 characters barrier you have to split
the chunk into several lines and assign each line to the indexed
Lines property.

Ciao
Michael

Re:How can I assign a large string to a memo field


Quote
Michael Jenc wrote:
> Mike Thompson wrote:

> > How can I assign a large string (ie 500 characters) to a memo field.

> > The following works if chunk is less than 255 characters.

> > DataB.QGeneral.FieldByName('Data').AsString := Chunk;

> > where 'Chunk' is a string < 255 characters
> > and 'Data' is a memo field in a paradox database.

> DataB.QGeneral.FieldByName('Data').Lines.Text := Chunk

> should do the work.
> If there is again the 255 characters barrier you have to split
> the chunk into several lines and assign each line to the indexed
> Lines property.

> Ciao
> Michael

No.  You should try this:

DataB.QGeneral.FieldByName('Data').Assign(LargeStringMemo.Lines);

Richard Tan.

Re:How can I assign a large string to a memo field


Quote
Mike Thompson wrote:

> How can I assign a large string (ie 500 characters) to a memo field.
> The following works if chunk is less than 255 characters.

> DataB.QGeneral.FieldByName('Data').AsString := Chunk;

> where 'Chunk' is a string < 255 characters
> and 'Data' is a memo field in a paradox database.

> I understand that it is possible to assign text contained in a TMemo
> control to a memo field, ie:
> DataB.QGeneral.FieldByName('Data').Assign(Memo1.Lines);

> but the text I want to store is not in a TMemo control, it is
> contained
> in a string passed in from 'the outside world'.  I need a way to
> assign
> this string to the memo field.

> If anyone can help I would be most apreciative,

> Mike
> m...@wds.co.nz

Use the SetData method.
DataB.QGeneral.FieldByName('Data').SetData(Chunk);

Jared Showalter

Other Threads