petr4ppc Well-Known Member Licensed User Longtime User Feb 21, 2013 #1 Dear friends, please for your help. I have in my code this: B4X: SQL1.ExecQuerySingleResult("SELECT name FROM users where value =" & getvalue & "and usernr ="& getnr) The trouble is with & "and usernr ="& getnr I get error = SQLiteException:unrecognized token How can I solve this multiple order to SQL, where I have mistake in code, please? Thank you very much and have a nice day p4ppc
Dear friends, please for your help. I have in my code this: B4X: SQL1.ExecQuerySingleResult("SELECT name FROM users where value =" & getvalue & "and usernr ="& getnr) The trouble is with & "and usernr ="& getnr I get error = SQLiteException:unrecognized token How can I solve this multiple order to SQL, where I have mistake in code, please? Thank you very much and have a nice day p4ppc
Erel B4X founder Staff member Licensed User Longtime User Feb 21, 2013 #2 The problem is that you are missing a space before 'and'. The real problem however is that you are not using a parameterized query: B4X: SQL1.ExecQuerySingleResult2("SELECT name FROM users where value = ? and usernr = ?", Array As String(getvalue, getnr)) Upvote 0
The problem is that you are missing a space before 'and'. The real problem however is that you are not using a parameterized query: B4X: SQL1.ExecQuerySingleResult2("SELECT name FROM users where value = ? and usernr = ?", Array As String(getvalue, getnr))
thedesolatesoul Expert Licensed User Longtime User Feb 21, 2013 #3 put a space before 'and': B4X: SQL1.ExecQuerySingleResult("SELECT name FROM users where value = " & getvalue & " and usernr = " & getnr) Upvote 0
put a space before 'and': B4X: SQL1.ExecQuerySingleResult("SELECT name FROM users where value = " & getvalue & " and usernr = " & getnr)
petr4ppc Well-Known Member Licensed User Longtime User Feb 21, 2013 #4 EREL AND THEDESOLATESOUL Very, very thank you: Your code Erel: B4X: SQL1.ExecQuerySingleResult2("SELECT name FROM users where value = ? and usernr = ?", Array As String(getvalue, getnr)) is very good. Everything is OK. I know, that I have read about this in your tutorial, where this multiple system is use for INSERT function in SQL. Now I know, that it is useful for SELECT function here is EREL´s SQL tutorial http://www.b4x.com/forum/basic4android-getting-started-tutorials/6736-sql-tutorial.html#post39108 Thank you very much Have a good day p4ppc :sign0142: Upvote 0
EREL AND THEDESOLATESOUL Very, very thank you: Your code Erel: B4X: SQL1.ExecQuerySingleResult2("SELECT name FROM users where value = ? and usernr = ?", Array As String(getvalue, getnr)) is very good. Everything is OK. I know, that I have read about this in your tutorial, where this multiple system is use for INSERT function in SQL. Now I know, that it is useful for SELECT function here is EREL´s SQL tutorial http://www.b4x.com/forum/basic4android-getting-started-tutorials/6736-sql-tutorial.html#post39108 Thank you very much Have a good day p4ppc :sign0142: