SQLiteException: no such column: basal (code 1)

后端 未结 5 2031
予麋鹿
予麋鹿 2021-01-22 13:00

I\'m working with databases and I have the following DataBaseHandling class:

public class DatabaseHandler extends SQLiteOpenHelper {

// All Static variables
//          


        
5条回答
  •  心在旅途
    2021-01-22 13:36

    Use a space after KEY_BASAL column . As your table column name was not correct , the table was created without this column. So after modifying code re-install your database or change version.Then you will get correct table with columns

    String CREATE_MEASURES_TABLE = "CREATE TABLE " + TABLE_MEASURES + "("
                + KEY_ID + " INTEGER PRIMARY KEY," + KEY_DATE + " TEXT,"
                + KEY_TIME_HOUR + " INTEGER NOT NULL," + KEY_TIME_MINUTE
                + " INTEGER NOT NULL," + KEY_BE_INTAKE + " REAL NOT NULL,"
                + KEY_GLUCOSE + " REAL NOT NULL," + KEY_BOLUS
                + " REAL NOT NULL," + KEY_BASAL + " REAL NOT NULL" + ")";
    
    
    if (cursor != null && cursor .getCount()>0){
    
            cursor.moveToFirst();
    
    ///
    
    }
    

提交回复
热议问题