Board index » delphi » What is the syntax for copy a memo to a database memo field

What is the syntax for copy a memo to a database memo field

Can someone please tell me what the syntax is for copying the contents
of a memo field (i.e., memo.lines) to a memo field in a database.
Better yet, I know that

Memo.lines.LoadFromFile('filename')

will load the contents of a file into memo.lines.  Is there a way to use
LoadFromFile to load directly into the memo field in the database.

ALL help is appreciated.

Thanks, Ken

 

Re:What is the syntax for copy a memo to a database memo field


If your goal is to load a text file (on disk) in a MemoField, then simply
do this:

having declared and created: TextLines : TStringList;

TextLines := TStringList.Create;    
TextLines.LoadFromFile('text.txt');
Table1.Edit;
Table1.FieldByName('MemoFieldName').AsString := TextLines.Text;
Table1.Post;

done.
--
Charles Bedard
beda...@videotron.ca

Kenneth P. Reeder, Ph.D. <kp...@uno.edu> wrote in article
<33B7727B.7...@uno.edu>...

Quote
> Can someone please tell me what the syntax is for copying the contents
> of a memo field (i.e., memo.lines) to a memo field in a database.
> Better yet, I know that

> Memo.lines.LoadFromFile('filename')

> will load the contents of a file into memo.lines.  Is there a way to use
> LoadFromFile to load directly into the memo field in the database.

> ALL help is appreciated.

> Thanks, Ken

Re:What is the syntax for copy a memo to a database memo field


Quote
Charles Bdard wrote:

> If your goal is to load a text file (on disk) in a MemoField, then simply
> do this:

> having declared and created: TextLines : TStringList;

> TextLines := TStringList.Create;
> TextLines.LoadFromFile('text.txt');
> Table1.Edit;
> Table1.FieldByName('MemoFieldName').AsString := TextLines.Text;
> Table1.Post;

> done.
> --
> Charles Bedard
> beda...@videotron.ca

> Kenneth P. Reeder, Ph.D. <kp...@uno.edu> wrote in article
> <33B7727B.7...@uno.edu>...
> > Can someone please tell me what the syntax is for copying the contents
> > of a memo field (i.e., memo.lines) to a memo field in a database.
> > Better yet, I know that

> > Memo.lines.LoadFromFile('filename')

> > will load the contents of a file into memo.lines.  Is there a way to use
> > LoadFromFile to load directly into the memo field in the database.

> > ALL help is appreciated.

> > Thanks, Ken

Other Threads