gpt4 book ai didi

java - Android 数据库错误 : no such column error

转载 作者:行者123 更新时间:2023-11-29 06:20:06 25 4
gpt4 key购买 nike

这是 logcat。

11-14 11:38:28.915  30243-30243/com.example.multical E/SQLiteLog﹕ (1) **no such column: isu**
11-14 11:38:28.925 30243-30243/com.example.multical E/AndroidRuntime﹕ **FATAL EXCEPTION: main**
Process: com.example.multical, PID: 30243
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.multical/com.example.multical.grade}: **android.database.sqlite.SQLiteException: no such column: isu (code 1): , while compiling: SELECT _id, subject, semester, credit, grade, isu FROM mygrades ORDER BY _id DESC**

Caused by: android.database.sqlite.SQLiteException: no such column: isu (code 1): , while compiling: SELECT _id, subject, semester, credit, grade, isu FROM mygrades ORDER BY _id DESC
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

**at com.example.multical.DBAdapter.getAllInfo(DBAdapter.java:88)
at com.example.multical.grade.onCreate(grade.java:81)**

com.example.multical.DBAdapter.getAllInfo(DBAdapter.java:88) source

Cursor c = db.query(TABLE_NAME, new String[]{ID, SUBJECT, SEMESTER, CREDIT, GRADE, ISU}, null, null, null,null, ID + " DESC");

com.example.multical.grade.onCreate(grade.java:81)**

mInfo = mDb.getAllInfo();

和 DBAdapter 变量

private static final String DB_NAME = "mygrade.db";
private static final int VERSION = 1;
public static Cursor cursor;
private static final String ID = "_id";
private static final String SUBJECT = "subject";
private static final String SEMESTER = "semester";
private static final String GRADE = "grade";
private static final String ISU = "isu";
private static final String CREDIT = "credit";
private static final String TABLE_NAME = "mygrades";
public static int count;
private static final String CREATE_TABLE =
"CREATE TABLE " + TABLE_NAME + " (" +
ID + " integer primary key autoincrement, " +
SUBJECT + " text not null, " +
SEMESTER + " text not null," + CREDIT +" text not null, " + GRADE +" text not null, " + ISU + " text not null );";

也许,我认为 Cursor c = db.query(TABLE_NAME, new String[]{ID, SUBJECT, SEMESTER, CREDIT, GRADE, ISU}, null, null, null,null, ID + "DESC "); 发生了。怎么了???请帮助我将不胜感激。 TT

最佳答案

先卸载应用,再重新安装应用。或者您可以将数据库版本 1 更改为 2。这可能对您有所帮助。

关于java - Android 数据库错误 : no such column error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33704682/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com