dimanche 15 mars 2015

android sql table update error

when i try to update a table it does not return any error.But update not works. Here is my insert and update querry can anyone tell is there any problem?


my insert statement(Working)



public long insertValueWithOnDate(int ParameterId,String value,String date,String operation)
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_PARAMETER_ID, ParameterId);
initialValues.put(KEY_UNIT_VALUE, value);
initialValues.put(KEY_OPERATION, operation);
initialValues.put(KEY_ON_DATE, date);
initialValues.put(KEY_OFF_DATE, "");
return db.insert(DATABASE_TABLE, null, initialValues);
}


My update statement(Not working)



public void insertValueWithOfDate(int ParameterId,String value,String date,String operation)
{
db.execSQL("update Entries set operation='"+operation+"',offdate='"+date+"',value='"+value+"' where parameterId='"+ParameterId+"' and operation='"+"onn"+"' and offdate='"+null+"'");
}


My table structure is as follows



_id parameterId operation ondate offdate value
--------------------------------------------------------------------
1 1 on 15-03-2015 15-03-2015 0
2 1 on 15-03-2015 null 0


Thanks in advance...


Aucun commentaire:

Enregistrer un commentaire