Hi all,
I need to update records in a database with ExecNonQuery2. But the values in the array need to be enclosed in quotes.
My query:
The query should look like:
I can't figure out how to combine the sql query with the smart string literals.
When I log the query in all cases I see
so the variables are not communicated (something to do with ExecNonQuery2 and quotes?).
I can work around it by building the query as a string first and then using ExecNonQuery instead of ExecNonQuery2 but I can't stand it I can't get to grips with the Smart String Literals (apparently I'm not smart enough ;-) )
Any nudge in the right direction is much appreciated.
B4J Version: 9.5
Java Version: 11
#AdditionalJar: sqlite-jdbc-3.7.2
DBUtils Version: 2.11
I need to update records in a database with ExecNonQuery2. But the values in the array need to be enclosed in quotes.
My query:
B4X:
sql.ExecNonQuery2("UPDATE parts SET PartID = ? WHERE PartID = ?",Array("'" & row(1) & "'", "'" & row(0) & "'")) '<-- this doesn't work
B4X:
UPDATE parts SET PartID = 'newvalue' WHERE PartID = 'oldvalue'
B4X:
sql.ExecNonQuery2($"UPDATE parts SET PartID ='?' WHERE PartID = '?'"$,Array(row(1),row(0))) '<-- this doesn't work either
sql.ExecNonQuery2("UPDATE parts SET PartID = ? WHERE PartID = ?",Array($"'${row(1)}'"$,$"'${row(0)}'"$)) '<-- nor does this
When I log the query in all cases I see
B4X:
UPDATE parts SET PartID = ? WHERE PartID = ?
I can work around it by building the query as a string first and then using ExecNonQuery instead of ExecNonQuery2 but I can't stand it I can't get to grips with the Smart String Literals (apparently I'm not smart enough ;-) )
Any nudge in the right direction is much appreciated.
B4J Version: 9.5
Java Version: 11
#AdditionalJar: sqlite-jdbc-3.7.2
DBUtils Version: 2.11