Pablo Pablo - 21 days ago 6
Android Question

How do I use prepared statements in SQlite in Android?

How do I use prepared statements in SQlite in Android?

Answer

I use prepared statements in Android all the time, it's quite simple :

SQLiteDatabase db = dbHelper.getWritableDatabase();
SQLiteStatement stmt = db.compileStatement("SELECT * FROM Country WHERE code = ?");
stmt.bindString(1, "US");
stmt.execute();