1
I am using a Delphi query and need to insert the text below in a text field
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fcharset0 Times New Roman;}{\f2\fnil\fcharset0 Tahoma;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\fi-11\qj\tx142\tx360\tx720\tx9700\cf1\lang1046\f0\fs18 ssssssss\par
\par
Cabe ao empregador quanto ao EPI, orientar e treinar o trabalhador sobre o uso adequado, guarda e conserva\'e7\'e3o.\par
\pard\fi-11\tx142\tx360\tx720\tx9700\par
\cf0\f1\fs24 CONTE\'daDO PROGRAM\'c1TICO\par
\cf1\b\i\f0\fs18\par
\b0\i0 - Utiliza\'e7\'e3o adequada\par
- Respons\'e1bilidade sobre Guarda e Conserva\'e7\'e3o\par
- Cumprir determina\'e7\'f5es do empregador sobre uso adequado \par
- Comunicar ao empregador qualquer altera\'e7\'e3o que torne impr\'f3prio para o uso \par
- C.A Certificado de aprova\'e7\'e3o \par
\par
\par
Com Certificado para a Empresa e Lista de Presen\'e7a.\par
\par
\pard\sb100\sa100\qj\cf0\f1\fs24 c\\sdc\par
\par
\pard\sb100\sa100\par
\pard\fi-11\tx142\tx360\tx720\tx9700\cf1\f0\fs18\par
\pard\cf0\f2\fs16\par
}
This text comes from an RTF file, so it has this crazy formatting, already tried with Loadfromfile, but when you record it appears a lot of ???? instead of the text
The command used is:
...
Arquivo := Stream.LoadFromFile('arquivo.rtf');
S := Arquivo.DataString;
Query := TQuery.Create(nil);
...
Query.SQL.Add('update tabela set campotext = '+QuotedStr(S)+'');
Query.ExecSQL;
The mistake:
SQL Error: ERROR: unterminated quoted string at or near "'{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 \\fnilTahoma;}}
\viewkind4\uc1\pard\qj\lang1046\f0\fs16\\zdv\\cxcv\par
\pard\par
}
"
LINE 2: texto = '{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\...
^
I’ve tried to put some leaks in, but no way
you have to use parameters in the query, or replace each one
'
for'''
(replace is gambiarra)– Rovann Linhalis
see: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Using_Parameters_in_Queries and http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Supplying_Parameters_at_Runtime
– Rovann Linhalis