刚刚进入Android开发的新用户!在尝试在Android Studio中创建表时,我似乎无法解决我一直收到的SQLiteException错误。这是一个语法错误,但我无法分辨线上的语法错误,尽管检查语法错误/ SQLiteExceptions上的类似帖子。我在下面的LoginDataBaseAdapater.java类中包含了一段代码:
公共类LoginDataBaseAdapter {
DummyRetriever
我不断收到的错误消息如下:
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "regDetailsDatabase.db";
private static final String TABLE_REG_DETAILS = "Registration Details";
public static final int COLUMN_ID = 1;
public static final String COLUMN_EMAIL_ADDRESS = "email_address";
public static final String COLUMN_USER_NAME = "user_name";
public static final String COLUMN_PASSWORD = "password";
public static final String COLUMN_DATE_OF_BIRTH = "dob";
public static final String COLUMN_MOBILE_NUMBER = "mobile_number";
static final String DATABASE_CREATE = "CREATE TABLE " + TABLE_REG_DETAILS + " ("+ COLUMN_ID + " INTEGER PRIMARY KEY, " + COLUMN_EMAIL_ADDRESS + " TEXT, " + COLUMN_USER_NAME + " TEXT, " + COLUMN_PASSWORD + " TEXT, " + COLUMN_DATE_OF_BIRTH + " TEXT, " + COLUMN_MOBILE_NUMBER + " TEXT " + ")";
语法错误似乎接近create table语句的TABLE_REG_DETAILS部分,但我不能在我的生活中弄清楚为什么会发生这种情况。有谁知道可能导致这个SQLiteException的原因是什么?非常感谢提前!
答案 0 :(得分:2)
private static final String TABLE_REG_DETAILS = "registration_details";
和
public static final String COLUMN_ID = "_id";
列的名称不能是数字