Android studio点击登录注册时程序运行停止为什么 Activity已注册过 5C

05-12 16:22:06.407 19855-19855/com.example.kira.mynewnote E/SQLiteLog: (1) no such column: password
05-12 16:22:06.407 19855-19855/com.example.kira.mynewnote D/AndroidRuntime: Shutting down VM
05-12 16:22:06.408 19855-19855/com.example.kira.mynewnote E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.kira.mynewnote, PID: 19855
android.database.sqlite.SQLiteException: no such column: password (code 1): , while compiling: select * from User where username=? and password=?
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:963)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:517)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1346)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1285)
at com.example.kira.mynewnote.LoginActivity$1.login(LoginActivity.java:65)
at com.example.kira.mynewnote.LoginActivity$1.onClick(LoginActivity.java:53)
at android.view.View.performClick(View.java:4848)
at android.view.View$PerformClick.run(View.java:20262)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5714)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:984)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

logcat错误红色的部分节选
求大神帮忙解答

2个回答

android.database.sqlite.SQLiteException: no such column: password (code 1): , while compiling: select * from User where username=? and password=?

错误信息说的很清楚了,当执行那句 sql 时,你的表中没有 password 这个字段( no such column: password)。找找表的问题先

 no such colum:password

证明你的表中没有这个字段

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!