Solved

Assigning data to a database memo field

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now