SQLite Android versus simulator

Just solved a week long annoying problem, thought I’d share. Had some code that worked fine on the simulator, but didn’t work on my Android device. Here is the code works on both the device and the simulator:

 print("Loading student points")  
 print("SELECT \* FROM students WHERE studentID = '"..\_G.studentID.."'")  
 for row in db:nrows("SELECT \* FROM students WHERE studentID = '"..\_G.studentID.."'") do  
 print("Loading row.points: ")  
 print(row.points)  
 myPoints = row.points  
 \_G.GUI.Set( "myPoints", { caption = "myPoints: "..myPoints } )  
 end  
 print("Student points loaded")  

In the code above, studentID is a text field in my SQLite db. When I left out the single quotes surrounding _G.studentID, it worked fine on the simulator, but not on the device. This was not obvious because I had a prior SELECT statement, for another table, where I did not use single quotes and that worked fine on the device and the simulator- however, that studentID was an integer field in my SQLite db.

In conclusion, if you have an SQLite field that is a text field, you must use single quotes surrounding the value you want to store. Then, the code will work fine on the Android device and simulator. I did not test this on iOS.
[import]uid: 104085 topic_id: 29802 reply_id: 329802[/import]