mardi 6 octobre 2015

Dont write data to database | SQLite

When I try save String like IupSH6M1e6FteCm30IQv9hTyxr7quFFFFFZuHjCein my Database it's dont work (string dont write to DB).

This is DDL of sqlite table:

  CREATE TABLE [settings] (
  [id] INTEGER PRIMARY KEY AUTOINCREMENT, 
  [key] TEXT, 
  [value] TEXT);

This is my code for write String to this table:

public void setProperty(String key, String value) {
    db.delete(SETTINGS_TABLE_NAME, "key='" + key + "'", null); // clear old data
    ContentValues initialValues = new ContentValues();
    initialValues.put("key", key);
    initialValues.put("value", value);
    db.insert(SETTINGS_TABLE_NAME, null, initialValues);
}

But string dont write to Database. Why?

Aucun commentaire:

Enregistrer un commentaire