您好,我正在尝试更新数据库中的表,但我收到我的列不存在的错误。该表之前已成功创建。我能够获取信息并对其进行操作,但我无法在我的编辑活动中更新这是我的部分代码:
//job_cost table------------------------------------------------
public static final String KEY_JOBCOSTID = "jobcostID";
public static final String KEY_JOBCOSTHOURSTREMA = "jobcostHourStrema";
public static final String KEY_JOBCOSTGROUNDTYPE = "jobcostGroundType";
public static final String KEY_JOBCOSTPETROL = "jobcostPetrol";
public static final String KEY_JOBCOSTOIL = "jobcostOil";
public static final String KEY_JOBCOSTMAINTENANCE = "jobcostMaintenance";
public static final String KEY_JOBCOSTOTHEREXPENSES = "jobcostOtherExpenses";
public static final String KEY_JOBCOSTFINAL = "jobcostFinal";
db.execSQL("CREATE TABLE " + DATABASE_JOBCOSTTABLE + "("
+ KEY_JOBCOSTID + " INTEGER PRIMARY KEY autoincrement , "
+ KEY_JOBCOSTHOURSTREMA + " DOUBLE , "
+ KEY_JOBCOSTGROUNDTYPE + " TEXT , "
+ KEY_JOBCOSTPETROL + " DOUBLE , "
+ KEY_JOBCOSTOIL + " DOUBLE , "
+ KEY_JOBCOSTMAINTENANCE + " DOUBLE , "
+ KEY_JOBCOSTFINAL + " DOUBLE , "
+ KEY_JOBCOSTOTHEREXPENSES + " DOUBLE )");
}
public boolean updateJobCost(Cost costTemp,String jobForEdit){
ContentValues cv = new ContentValues();
cv.put( "KEY_JOBCOSTHOURSTREMA" , costTemp.getHourStrema());
cv.put( "KEY_JOBCOSTGROUNDTYPE" , costTemp.getGroundType());
cv.put( "KEY_JOBCOSTPETROL" , costTemp.getPetrol());
cv.put( "KEY_JOBCOSTOIL" , costTemp.getOil());
cv.put( "KEY_JOBCOSTMAINTENANCE" , costTemp.getMaintenance());
cv.put( "KEY_JOBCOSTOTHEREXPENSES" , costTemp.getOtherExpenses());
cv.put( "KEY_JOBCOSTFINAL" , costTemp.getCost());
//cv.put(key, value)
ourDatabase.updateWithOnConflict(DATABASE_JOBCOSTTABLE, cv, KEY_JOBCOSTID + "=" + jobForEdit, null, DATABASE_VERSION);
return false;
}