public long insert(User user) {
    ContentValues values = new ContentValues();
    values.put("name", user.username);
    return dbInstance.insert(DB_TABLENAME, null, values);
}AndroidsqliteinsertContentValues

解决方案 »

  1.   

    请问怎么组成呢?我第一次接触数据库编程,之前学过简单的sql语句基础,请大侠明示啊。最好有代码演示的。谢过
      

  2.   

    public void onCreate(SQLiteDatabase db) {
    db.execSQL("create table if not exists " + TAB_NAME + " (" + KEY_ID
    + " integer primary key," + KEY_RECORD + " integer," + KEY_LEVEL + " integer)");
    }
    比如可以这样写
      

  3.   

    没有非要用ContentValues 类的说法   只是android 提供了该api方便不会使用sql语句的开发人员也可以执行sql操作直接写sql语句也是可以的       String stmt ="UPDATE secure SET value='com.android.inputmethod.latin/.LatinIME' where name='default_input_method'";         
           db.execSQL(stmt); 
      

  4.   

    非常感谢。
    还有这个contentValue网上说和java中的map机制很像,我不是很明白?
      

  5.   

    非常感谢。
    还有这个contentValue网上说和java中的map机制很像,我不是很明白其中的奥妙,求解释
      

  6.   

    非常感谢。
    还有这个contentValue网上说和java中的map机制很像,我不是很明白其中的奥妙,求解释呵呵意思就是说和Map使用的方法 语句结构  效果差不多     只是contentValue 实用于SQLlite数据库操作