我想通过使用下面的语句查询当前年度总价的总和,但总是出错:java.lang.StringIndexOutOfBoundException:length = 8,index = 2013 .. 它有什么我应该改变代码吗?
public double SumPriceYear(){
int yyyy = Integer.valueOf(getThisYear());
Cursor sum = ourDatabase.rawQuery("SELECT SUM( " + Pro_Price + " ) FROM "+ TABLE_NAME + " Where " + Pro_Date + " LIKE '%" + yyyy + "%' ", null);
if(sum.moveToFirst())
{
return sum.getDouble(0);
}
return sum.getDouble(0);
}