S stanks Active Member Licensed User Longtime User Dec 1, 2018 #1 for example i have some stuff in list. i have 2 types of values. numbers and string. numbers are integers only. strings are not only characters but i have /, ?, etc. (like web links). example: listNumbers, listNames and listL are the same size Code: Copy For i = 0 To listNumbers.Size - 1 sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, ${listNumbers.Get(i)}, ${listNames.Get(i)}, 1, ${listL.Get(i)}, 1)"$) with this code i always get error Code: Copy (near "kolo": syntax error (code 1): , while compiling: INSERT INTO lTest VALUES(2, 1, kolo1 - kolo2, 1, /456/234/44?xx=2, 1)) any idea? thanks p.s. Logging of above statement gives correct string for inserting
for example i have some stuff in list. i have 2 types of values. numbers and string. numbers are integers only. strings are not only characters but i have /, ?, etc. (like web links). example: listNumbers, listNames and listL are the same size Code: Copy For i = 0 To listNumbers.Size - 1 sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, ${listNumbers.Get(i)}, ${listNames.Get(i)}, 1, ${listL.Get(i)}, 1)"$) with this code i always get error Code: Copy (near "kolo": syntax error (code 1): , while compiling: INSERT INTO lTest VALUES(2, 1, kolo1 - kolo2, 1, /456/234/44?xx=2, 1)) any idea? thanks p.s. Logging of above statement gives correct string for inserting
npsonic Active Member Licensed User Dec 1, 2018 #4 Code: Copy For i = 0 To listNumbers.Size - 1 sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, '${listNumbers.Get(i)}' , '${listNames.Get(i)}' , 1, '${listL.Get(i)}' , 1)"$) Upvote 0
Code: Copy For i = 0 To listNumbers.Size - 1 sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, '${listNumbers.Get(i)}' , '${listNames.Get(i)}' , 1, '${listL.Get(i)}' , 1)"$)
S stanks Active Member Licensed User Longtime User Dec 1, 2018 #5 oh so i am missing ' .... ok thanks. will try this Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Dec 2, 2018 #6 The correct answer is to use ExecNonQuery2. Code: Copy sql1.ExecNonQuery2($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...)) Watch the SQL databases video tutorial: https://www.b4x.com/etp.html Last edited: Dec 2, 2018 Upvote 0
The correct answer is to use ExecNonQuery2. Code: Copy sql1.ExecNonQuery2($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...)) Watch the SQL databases video tutorial: https://www.b4x.com/etp.html
mangojack Expert Licensed User Longtime User Dec 2, 2018 #7 Erel said: The correct answer is to use ExecNonQuery2. Code: Copy sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...)) Click to expand... Small correction .. should be Code: Copy sql1.ExecNonQuery2($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...)) Upvote 0
Erel said: The correct answer is to use ExecNonQuery2. Code: Copy sql1.ExecNonQuery($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...)) Click to expand... Small correction .. should be Code: Copy sql1.ExecNonQuery2($"INSERT INTO lTest VALUES(2, ? ,? , 1, ? , 1)"$, Array As String(listNumbers.Get(i), ...))