Page 1 of 1

TMemoField update

Posted: Mon 19 Jun 2006 23:24
by Klaus Schirra
Hi,

I want to save sql-statements in a TMemoField.

Debug Example:
UPDATE berichte
SET
SQL = :6
WHERE
ID = :Old_1 AND Deleted = :Old_2 AND Name = :Old_3 AND HauptMenu = :Old_4 AND Menu IS NULL AND WFile = :Old_7 AND RFile IS NULL AND Freigabe = :Old_9 AND Seitentitel = :Old_10 AND C_DAT = :Old_11 AND I_dat = :Old_12 AND Adr_ersatz = :Old_13

:6(Memo,IN)=
:Old_1(Integer,IN)=2000
:Old_2(Integer,IN)=1
:Old_3(FixedChar[13],IN)='Dozentenliste'
:Old_4(FixedChar[8],IN)='Berichte'
:Old_7(FixedChar[12],IN)='TN_Liste.dot'
:Old_9(SmallInt,IN)=0
:Old_10(FixedChar[13],IN)='Dozentenliste'
:Old_11(DateTime,IN)=01.01.1980
:Old_12(DateTime,IN)=01.01.1980
:Old_13(SmallInt,IN)=0

Result:
#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SQL, WFile, Freigabe, Seitentitel, C_DAT, I_dat, Adr_ersatz)
VALUES
(2000, 1' at line 2

Without the Memo-Field Update is successfull.

Any idea, i tried all workarounds mentioned in this forum.

Posted: Tue 20 Jun 2006 06:23
by Klaus Schirra
Problem must be the fieldname "SQL" in my SQL-statement.
Is this fieldname not allowed?

Posted: Tue 20 Jun 2006 07:04
by Antaeus
You try using reserved word 'SQL' as field name. To avoid this problem you should set option QuoteNames to True.

Posted: Tue 20 Jun 2006 07:48
by Klaus Schirra
thanks Antaeus... :D

Posted: Tue 20 Jun 2006 20:44
by GEswin
Best is not to use reserved words as field/table/view etc names. Have a look at http://dev.mysql.com/doc/refman/5.0/en/ ... words.html to know which ones are reserved. This will avoid you a lot of problems ;)