Board index » delphi » Memo Fields / TMemo

Memo Fields / TMemo

Hello,

How I can assign the lines of a memo (in a TMemo component), to a Memo
Field, in a paradox 5/7 table, using the SQL Update statement??
--

[]'s

Eric Lemes de Godoy Cintra
Mogi das Cruzes - SP - Brasil
ericle...@hotmail.com
ericle...@brasmail.com.br

 

Re:Memo Fields / TMemo


On Fri, 16 Oct 1998 15:59:21 -0300, Eric Lemes <ericle...@brasmail.com.br>
wrote:

Quote
>How I can assign the lines of a memo (in a TMemo component), to a Memo
>Field, in a paradox 5/7 table, using the SQL Update statement??

Assuming you are using Delphi 3 or above...

Represent the memo field in the SQL statement as a parameter. For example,
the parameter MemoParam in the statement below.

  INSERT INTO "SomeTable.db"
  (ID, MField)
  VALUES (:IDParam, :MemoParam)

Then, before executing the statement (using the TQuery.ExecSQL method),
fill the parameter with a value. Use the properties and methods of the
TParam object to give the parameter a value. Which you use is predicated on
what form the source data is in.

If it is in a file, use the TParam.LoadFromFile method. For example:

  Query1.ParamByName('MemoParam').LoadFromFile('c:\windows\readme.txt');

If the source is in an assignment-compatible object (like the Lines
property of a TMemo), use the Assign method.

  Query1.ParamByName('MemoParam').Assign(Memo1.Lines);

If it is in a PChar (or equivalent) memory buffer, use direct assignment
and the TParam.AsMemo property.

  Query1.ParamByName('MemoParam').AsMemo := Buffer;

If the source is in a stream (such as TFileStream or TMemoryStream), use
the TParam.LoadFromStream method.

  Query1.ParamByName('MemoParam').LoadFromStream(YourStream, ftMemo);

//////////////////////////////////////////////////////////////////////////
Steve Koterski                 "What is success in this world? I would say
Technical Publications         it consists of four simple things: to live
INPRISE Corporation            a lot, to love a lot, to laugh a lot, and
http://www.inprise.com/delphi  from it all, to learn a lot."
                                                     -- Richard J. Needham

Other Threads