OliverA Expert Licensed User Longtime User Apr 4, 2018 #1 Looks like there is an issue in the sample program included in the SQL video. These lines (34&36): B4X: Dim id As String = "k'm" Dim rs As ResultSet = sql.ExecQuery2("SELECT name, birth, image FROM students WHERE id = " & id, Array As String(10)) Lead to this java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "'m") Click to expand... Line 36 is actually causing the error, but it's caused by the value set in line 34. Not sure what was supposed to happen here.
Looks like there is an issue in the sample program included in the SQL video. These lines (34&36): B4X: Dim id As String = "k'm" Dim rs As ResultSet = sql.ExecQuery2("SELECT name, birth, image FROM students WHERE id = " & id, Array As String(10)) Lead to this java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (unrecognized token: "'m") Click to expand... Line 36 is actually causing the error, but it's caused by the value set in line 34. Not sure what was supposed to happen here.
DonManfred Expert Licensed User Longtime User Apr 5, 2018 #2 Maybe parametrized? B4X: Dim rs As ResultSet = sql.ExecQuery2("SELECT name, birth, image FROM students WHERE id = ?", Array As String(id)) Note that you did used Parametrized query but your are not using the parameter. Upvote 0
Maybe parametrized? B4X: Dim rs As ResultSet = sql.ExecQuery2("SELECT name, birth, image FROM students WHERE id = ?", Array As String(id)) Note that you did used Parametrized query but your are not using the parameter.
Erel B4X founder Staff member Licensed User Longtime User Apr 5, 2018 #3 It was a leftover from the "don't do" section. I will update the correct code. Upvote 0