Re: [Delphi 6] How can i copy a DbMemo to a Memo?




"Broc_Ex_Co" <brocexco@xxxxxxxxxx> wrote in message news:485bc692$0$866$ba4acef3@xxxxxxxxxxxxxxxxx

if Not VarIsNull (aTable ['Memo1']) // it will be Null if it's blank or empty, i.e. ''
then aMemo.Lines.Text := aTable ['Memo1']
else aMemo.Clear;

or

aMemo.Lines.Text := aTable.FieldByName ('Mem1').AsString;

Thanx a lot!
I tried your way, but i have an error : Access violation at adress ...... .....

Do you have another suggestion of amelioration?



I gave you two methods, which caused and access violation? If it was both, then I would suspect your code. I did test the methods before posting them.

Sorry! i use your first method ... but it was with table using the component Tdbf (from sourceforge).
I'll try with a component Ttable BDE during the week-end!


Both methods should work with any tDataSet descendant. An alternate might be something like

aMemo.Lines.Text := VarToStr (aTable.FieldByName ('Memo1').Value)

I can't recall how VarToStr reacts to a Null variant, it should return ''. If it raises an Invalid Variant Conversion exception then one would have to test for Null before the line above.

.



Relevant Pages

  • Re: [Delphi 6] How can i copy a DbMemo to a Memo?
    ... but i have an error: Access violation at adress ... I'll try with a component Ttable BDE during the week-end! ... I can't recall how VarToStr reacts to a Null variant, ... And that last alternate solution is a good one, ...
    (alt.comp.lang.borland-delphi)
  • Access Violation in module oleaut32.dll
    ... "Project mat.exe raised exception class EAccessViolation with ... message 'Access violation at adress 779D9405 in ...
    (borland.public.delphi.database.ado)
  • Re: gelöschte Dateien auf Windows XP Home
    ... Bei mir stürzt es immer mit einer Fehlermeldung a la "Access Violation in ... Adress ..." ... daß Windows nicht mehr auf die betroffene ...
    (microsoft.public.de.german.windowsxp.sonstiges)
  • TADOStoreproc
    ... MANYstore procedures in the database. ... I got "access violation at adress ... occurs if I run in dos command and it is not duplicable if I run from Delphi ...
    (borland.public.delphi.database.ado)
  • Access violation errors !
    ... WinXP Pro & SP1a ... Get recently, repetedly, error message stating "Access Violation at 77F4ACD7 ... Write of adress 0040480D" ...
    (microsoft.public.windowsxp.general)