Board index » delphi » Assigning Strings to a TDBMemo

Assigning Strings to a TDBMemo

I want to assign the contents of a TStringList to a memo field.  What I
tried was this:

    with MyTable do begin
      Insert;
      {the "Header" field is a DBEdit}
      FieldByName('Header').AsString := 'This is the header.';
      {the "Detail" field is a DBMemo}
      FieldByName('Detail').Lines := MyStrings.Strings;       <  compiler
stops here
      Post;
    end;

Can anybody tell me the right way to do this?

thanks,

James

 

Re:Assigning Strings to a TDBMemo


Try:

    FieldByName('Detail').Assign(MyStrings.Strings);

Woody

Quote

>    with MyTable do begin
>      Insert;
>      {the "Header" field is a DBEdit}
>      FieldByName('Header').AsString := 'This is the header.';
>      {the "Detail" field is a DBMemo}
>      FieldByName('Detail').Lines := MyStrings.Strings;       <
compiler
>stops here
>      Post;
>......
>thanks,

>James

Re:Assigning Strings to a TDBMemo


Woody:

Thanks.  That almost worked.  Turns out what I needed was:

        FieldByName('Detail').Assign(MyStrings);

Thanks again,

James

Other Threads