我正在尝试制作一个简单的登录注册系统,并且观看了youtube上的视频,因此出现了这个问题。
Cursor cursor = db.rawQuery("Select * from user where email=?", new String[]{email});
这是出问题的地方
public DatabaseHelper(Context context) {
super(context, "Login.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("Create table user(email text primary key, password text)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("drop table if exists user");
}
public boolean insert(String email, String password) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("email", email);
contentValues.put("password", password);
long ins = db.insert("user", null, contentValues);
if(ins==-1) return false;
else return true;
我注册一个帐户后,我的应用程序崩溃了。 我正在使用sqlite。
这是数据库帮助程序代码
{{1}}
答案 0 :(得分:0)
没有这样的列:电子邮件
这意味着您的表中不存在您的列。如果以后添加了它,请卸载该应用程序,或增加数据库架构。