How to insert value in data base using sqlite in android?

后端 未结 5 1730
旧巷少年郎
旧巷少年郎 2020-12-11 05:27

Can you please tell me how to insert value in database. I just started development in android don\'t have much experience.

I just create one class information<

5条回答
  •  借酒劲吻你
    2020-12-11 05:54

    The first error is because of the extra comma you have put inside the createTable string after the last column definition KEY_NAME+" TEXT,"

    String createTable= "CREATE TABLE " + TABLE_Name+"("
                + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_NAME + " TEXT,"
                + ")";
    

    the correct form is as follow :

    String createTable= "CREATE TABLE " + TABLE_Name+"("
                + KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + KEY_NAME + " TEXT"
                + ")";
    

提交回复
热议问题