Pablo Pablo - 1 year ago 60
Android Question

How do I use prepared statements in SQlite in Android?

How do I use prepared statements in SQlite in Android?

Answer Source

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();