Help With Android Sqlite - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Help With Android Sqlite (835 Views)
1 Reply
| Help With Android Sqlite by Jinf(op): 6:57am On Apr 22, 2015 |
I'm getting this error: android.database.sqlite.SQLiteException: near "EXIST": syntax error: CREATE TABLE IF NOT EXIST EPuserStatus(Status VARCHAR); See my code below... SQLiteDatabase db = openOrCreateDatabase("ExamPoemsStatus", MODE_PRIVATE, null); try { db.execSQL("CREATE TABLE IF NOT EXIST EPuserStatus(Status VARCHAR);" ;db.execSQL("INSERT INTO EPuserStatus Values('good');" ;Cursor result = db.rawQuery("SELECT * FROM EPuserStatus", null); result.moveToFirst(); String status = result.getString(1); Toast.makeText (getBaseContext(), "Data: " +status.toString(), Toast.LENGTH_SHORT).show(); db.close(); } catch (Exception e) {Toast.makeText (getBaseContext(), "Error: " +e.toString(), Toast.LENGTH_LONG).show(); } |
| Re: Help With Android Sqlite by nollyj: 8:25am On Apr 22, 2015 |
It should be exists instead of exist (notice the "s" at the end). |
| Re: Help With Android Sqlite by Jinf(op): 8:49am On Apr 22, 2015 |
nollyj:OMG Thanks! God bless you. I've corrected it and it's working. |
Help! Sqlite Database Not Updating After Using Bind_param • Anybody Here Know How One Can Password/encrypt Sqlite Database in C++? • Help With Sqlite Select • 2 • 3 • 4
20 Great Google Secrets • I Want Someone To Create An App For My Wordpress Blog • Be a Provider Of Mobile Messaging Business In Nigeria (image)
;