logcat的:
04-26 22:46:31.940 32461-32461/com.elnaggar.blooddonation
E/SQLiteLog﹕ (1) near "Request": syntax error 04-26 22:46:31.970
32461-32461/com.elnaggar.blooddonation E/AndroidRuntime﹕ FATAL
EXCEPTION: main
android.database.sqlite.SQLiteException: near "Request": syntax error (code 1): , while compiling: CREATE TABLE Donation Request(_id
INTEGER PRIMARY KEY AUTO INCREMENT, _full_address TEXT NOT NULL,
_description TEXT NOT NULL, _contact_info TEXT NOT NULL,_area TEXT NOT NULL, _blood_type TEXT NOT NULL);
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
Method)
代码:
public void onCreate(SQLiteDatabase arg0) {
arg0.execSQL("CREATE TABLE " + DATABASE_TABLE + "(" + KEY_ROW_ID
+ " INTEGER PRIMARY KEY AUTO INCREMENT, " + KEY_FULL_ADDRESS
+ " TEXT NOT NULL, " + KEY_DESCRIPTION + " TEXT NOT NULL, "
+ KEY_CONTACT_INFO + " TEXT NOT NULL," + KEY_AREA
+ " TEXT NOT NULL, " + KEY_BLOOD_TYPE + " TEXT NOT NULL);");
}
答案 0 :(得分:0)
您的表名:Donation Request
由2个单词组成,而只有一个单词。将Donation Request
替换为DonationRequest