我正在尝试使用 SQLite 在 android 中创建一个表,但出现错误“没有这样的列”。我检查了一切都是正确的,请帮助我解决这个问题。谢谢
创建表的代码是:
public static final String DATABASE_NAME="Employee.db";
public static final int DATABASE_VERSION=1;
public static final String TABLE_EMPLOYEE="Employee";
public static final String COLUMN_ID="Empid";
public static final String COLUMN_NAME="Empname";
public static final String COLUMN_SALARY="Empsalary";
public static final String createReq="CREATE TABLE " + TABLE_EMPLOYEE + "("
+ COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_NAME + " TEXT,"
+ COLUMN_SALARY + " NUMERIC" + ")";
public dbhelper(Context context)
{
super(context,DATABASE_NAME,null,DATABASE_VERSION);
Log.e("dbhelper constructor: ", "dbhelper const called..");
}
@Override
public void onCreate(SQLiteDatabase db)
{
Log.e("onCreate method of dbhelper: ", "onCreate method of dbhelper method called..");
db.execSQL(createReq);
}
当我在 logcat 中打印表的列名时,它显示 col: Empid Col: EmpnameTEXTEmpsalaryNUMERIC