[英]java.lang.ArrayIndexOutOfBoundsException in sqlite (android)
i have create a table in sqlite that giving me java.lang.ArrayIndexOutOfBoundsException here is code : 我已经在sqlite中创建了一个表,给我java.lang.ArrayIndexOutOfBoundsException这里是代码:
db.execSQL("CREATE TABLE "+scoreboardTable+" ("+scoreboard_id+ " INTEGER PRIMARY KEY NOT NULL,"+" FOREIGN KEY ( "+player_fk+ ") REFERENCES "+playerTable+" ("+playerid+ "), "
+"FOREIGN KEY ( "+ Template_fk+ ") REFERENCES " +TemplateTable+" ("+ templateid+ "),"+ total_flick+"int"+surprise_success+"varchar"+surprise_failure+"varchar)");
}
and 和
public void Insert_scoreboard(String[] str)
{
try
{
SQLiteDatabase DB= this.getWritableDatabase();
ContentValues cv=new ContentValues();
cv.put("scoreboard_id", str[0]);
cv.put("player_fk", str[1]);
cv.put("Template_fk", str[2]);
cv.put("total_flick", str[3]);
cv.put("surprise_success", str[4]);
cv.put("surprise_failure", str[5]);
DB.insert( scoreboardTable , "scoreboard", cv);
DB.close();
}
catch(Exception ex)
{
ex.toString();
}
where im doing wrong . 我在哪里做错了。
You have error in Create Table Syntax
( you forgot comma , at some places ) update your code with following code, 您在
Create Table Syntax
出错(在某些地方忘记了逗号) ,请使用以下代码更新代码,
db.execSQL( "CREATE TABLE " + scoreboardTable + " (" + scoreboard_id + " INTEGER PRIMARY KEY NOT NULL," + " FOREIGN KEY ( "+player_fk+ ") REFERENCES " + playerTable + " (" + playerid + "), " + "FOREIGN KEY ( " + Template_fk + ") REFERENCES " + TemplateTable + " (" + templateid + ")," + total_flick + "int, " + surprise_success + "varchar, " + surprise_failure + "varchar)" );
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.