Solved

Assigning data to a database memo field

Posted on 2002-07-15
4
308 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 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