在SQLite表中插入新行

时间:2018-12-16 19:32:40

标签: sqlite insert

我一直试图在SQLite表中插入新行,但是每当我启动应用程序时,它就会崩溃,我做了一些测试,结果发现问题出在此功能上。

    public void addUser(String email, String password){
    SQLiteDatabase db = getWritableDatabase();
    String sql_INSERT = "INSERT INTO users (email ,password) values (?,?)";

    SQLiteStatement statement = db.compileStatement(sql_INSERT);

    statement.bindString(1,email);
    statement.bindString(2,password);
    statement.execute();
}

0 个答案:

没有答案