I have problems with addings rows into a QSL-table with proper SQL-statements from LotusScript.I believe the problem is caused by the use of constants and variables in the SQL-statement.
Part of code:
pricelist=doc.getitemvalue(“pricelistUK”)
art=doc.getitemvalue(“artcodeUK”)
price=doc.getitemvalue(“priceuk”)
set result.Query=qry
qry.SQL=“INSERT INTO tabel1(pricelist, artcode, quantity) values (|& pricelist &|,|& art &|,|& price &|, ‘1’)”
result.Execute
The error is: ODBC could not complete the requested operation.
I also used:
qry.SQL=“INSERT INTO tabel1(pricelist, artcode, quantity) values ('”& pricelist &“‘,’”& art &“‘,’”& price &“', ‘1’)”
When I replace the variables with constants, like:
qry.SQL=“INSERT INTO tabel1(pricelist, artcode, quantity) values (‘200008’, ‘ZZMAAT’, ‘208’, ‘1’)”
the record is added to the SQL-table.
So, the question is: how can I use variables in this sQL Insert-statement?