Solved

Assigning data to a database memo field

Posted on 2002-07-15
4
306 Views
Last Modified: 2010-04-04
An easy one for you (probably)!

When appending data from a screen form to a database I'm using syntax like

FieldByName('CallType').AsString := edtCallType.Text;

What's the corresponding syntax for a memo field?

I assumed it would be something like

FieldByName('Comments').AsMemo := mmComments.Lines;

but life isn't that simple...

Many thanks for your help
0
Comment
Question by:riccohb
[X]
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
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7153917
just from head,
don't know if possible

TBlobField(FieldByName('Comments')).Text := mmComments.Lines;

or

TBlobField(FieldByName('Comments')).asText := mmComments.Lines;

or also

TBlobField(FieldByName('Comments')).asString := mmComments.Lines;

meikl ;-)
0
 

Author Comment

by:riccohb
ID: 7153941
Thanks for your help, but...

TBlobField(FieldByName('Comments')).Text := mmComments.Lines;

and

TBlobField(FieldByName('Comments')).asString := mmComments.Lines;

bring up the error 'Incompatible types: String and TStrings'

There's no such identifier as 'asText'.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 7153950
use
mmComments.text;

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7153954
if all fails

var
  m : tmemorystream;
begin
  m := tmemorystream.Create;
  try
    mmComments.Lines.SaveToStream(m);
    m.position := 0;
    TBlobField(FieldByName('Comments')).LoadFromStream(m);
  finally
    m.free;
  end;
end;

meikl ;-)
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

756 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