如何在数据库适配器中编写execsql
db.execSQL("UPDATE DeviceDetails SET devicename = ? WHERE uuid = ?",
new String[] {
edittext.getText().toString(),
c.getString(c.getColumnIndex("uuid"))
});
我在数据库中做了如下
public void select(String query) throws SQLException {
db.execSQL(query, null);
}
答案 0 :(得分:1)
试试这个
Cursor c = sqliteDB.rawQuery("UPDATE "+ TABLE_NAME + " SET "+ WHAT_YOU_WANT_TO_SET + " = "+WITH_WHAT_VALUE+ " WHERE " + WHAT_YOU_WANT_TO_MATCH + " = \""+WITH_WHAT+"\"", null);