I have a databaseHelper class. But, I want to multiply two values of each row and store it in another column while a button is clicked. I have checked my query and it works fine but I want to directly multiply the values and make change in the database when a button is click. I don't want to return any values but simply execute the query.
What I did for this is I have created a method in my database helper class. This is the method:
public void getTicketTotal(){
SQLiteDatabase db=this.getWritableDatabase();
db.rawQuery("update ticket_table set total=quantity*item_price ",null);
}
and in the button click event I did this. But, it didn't multiply and store the values in the table:
myDb=new DatabaseHelper(TicketActivity.this);
myDb.getTicketTotal();
What to do?