How to get string Data from Tmemofield
Posted: Wed 27 Oct 2010 17:49
I used TWideMemoField to save rtf text and now i have specific requirement to insert this rtf data in another table using Query
for this i used delphi code as Follows
[code]
// get data as string
rtfText := ThisQuery.FieldByName('RTF').AsWideString;
NewQuery.SQL.TEXT := 'Insert into NEWTABLE SET RTF= QuotedStr(rtfText );
NewQuery.Execute;
[/code]
when there are multiple lines in RTF text, i do have error in executing Query, after debugging NewQuery.SQL.TEXT i found that there are '#$D#$A' embedded in the Query text
Insert into NEWTABLE SET RTF=' {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}'#$D#$A'{\colortbl ;\red0\green0\blue255;}'#$D#$A'\viewkind4\uc1\pard\cf1\lang1040\b\fs16 MY TEXT!\cf0\b0\fs18\par'#$D#$A'}'#$D#$A#0''
is it correct method? if not please help me by suggesting some alternative method?(i want to do it through query)
Thanks
for this i used delphi code as Follows
[code]
// get data as string
rtfText := ThisQuery.FieldByName('RTF').AsWideString;
NewQuery.SQL.TEXT := 'Insert into NEWTABLE SET RTF= QuotedStr(rtfText );
NewQuery.Execute;
[/code]
when there are multiple lines in RTF text, i do have error in executing Query, after debugging NewQuery.SQL.TEXT i found that there are '#$D#$A' embedded in the Query text
Insert into NEWTABLE SET RTF=' {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}'#$D#$A'{\colortbl ;\red0\green0\blue255;}'#$D#$A'\viewkind4\uc1\pard\cf1\lang1040\b\fs16 MY TEXT!\cf0\b0\fs18\par'#$D#$A'}'#$D#$A#0''
is it correct method? if not please help me by suggesting some alternative method?(i want to do it through query)
Thanks