如何在android中编写execsql()

时间:2014-03-21 10:34:05

标签: android

如何在数据库适配器中编写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);
}

1 个答案:

答案 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);