Android:SQLite在插入行时没有这样的表

Android:SQLite在插入行时没有这样的表,android,sql,database,Android,Sql,Database,我试图在数据库首次创建时将行插入数据库 @Override public void onCreate(SQLiteDatabase db) { // Only uses this method when the database is first created. //Sets up the database - telling it the table name and all //the column names. db

我试图在数据库首次创建时将行插入数据库

@Override
    public void onCreate(SQLiteDatabase db) {
        // Only uses this method when the database is first created.
        //Sets up the database - telling it the table name and all
        //the column names.
        db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + 
                KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                KEY_REPS + " TEXT NOT NULL, " +
                KEY_ABS + " TEXT NOT NULL);"    
        );

        db.execSQL("INSERT INTO DATABASE_TABLE(KEY_REPS, KEY_ABS) VALUES ('25', 'Reverse Crunches' );" );
        db.execSQL("INSERT INTO DATABASE_TABLE(KEY_REPS, KEY_ABS) VALUES ('25', 'Crunches' );" );
        db.execSQL("INSERT INTO DATABASE_TABLE(KEY_REPS, KEY_ABS) VALUES ('1 minutes', 'Plank' );" );
        db.execSQL("INSERT INTO DATABASE_TABLE(KEY_REPS, KEY_ABS) VALUES ('30', 'Toe Touches' );" );
        db.execSQL("INSERT INTO DATABASE_TABLE(KEY_REPS, KEY_ABS) VALUES ('50', 'Russian Twists' );" );

    }
如果我没有在那里插入调用,数据库将创建良好的,我可以添加到它,查看它,等等。但是,由于某种原因,当我尝试将插入数据的调用放在create上时,我得到一个错误“没有这样的表”

我尝试将insert调用放在一个单独的名为Populate的方法中,并在我的主活动中调用该方法,但这也会产生一个错误


不知道我做错了什么。任何帮助都将不胜感激。

不要使用命名表的字符串(由
DATABASE\u table
字符串变量表示),而是直接使用字符串
“DATABASE\u table”
(这对数据库没有任何意义,因为您没有表
DATABASE\u table
)。按如下方式更新插入调用:

db.execSQL("INSERT INTO " + DATABASE_TABLE + "(" + KEY_REPS +", " + KEY_ABS + ") VALUES ('25', 'Reverse Crunches' );" );
另一个insert调用也是如此(看看您是如何声明创建sql字符串的)。 进行此修改后,卸载应用程序并重新安装,以便
SQLiteOpenHelper
可以看到更改