B4J Question SQLite [Resolved]

Sergey_New

Well-Known Member
Licensed User
Longtime User
If there is an apostrophe in the string, an error occurs. How to pass the string value correctly?
B4X:
Dim key As String="I1"
Dim str As String="d'Ydewalle"
db.ExecNonQuery("INSERT INTO names (id, name) VALUES ('" & key & "', '" & str & "')")
 
Solution
B4X:
Dim key As String="I1"
Dim str As String="d'Ydewalle"
db.ExecNonQuery2("INSERT INTO names (id, name) VALUES (?, ?)", Array(key, str))

LucaMs

Expert
Licensed User
Longtime User
Use db.ExecNonQuery2

(read the contextual help)

Clipboard02.jpg
 
Upvote 1
Top