简体   繁体   中英

Update row in sqlite android

I am trying to update a row in a table in sqlite in android but it update all rows and not just the row that I want.

This is my code:

public void EditarLinhaRecorrencia(int escolhaMensal
   , int escolhaSemanal
   , int escolhaDiaria
   , int escolhaOutro
   , int frequencia
   , String hora
   , String iDPrescricao)
{
    ContentValues valores =new ContentValues();
    valores.put("Mensal", escolhaMensal);
    valores.put("Semanal", escolhaSemanal);
    valores.put("Diario", escolhaDiaria);
    valores.put("OutrasFrequencias",escolhaOutro);
    valores.put("Frequencia",frequencia);
    valores.put("HoraTomas",hora);
    abrir();
    this.db.update("Recorrencia",valores, iDPrescricao,null);
    fechar();
}

counting that the prescription column is named 'prescricao'

String whereComparison = "prescricao=" + iDPrescricao;
...
this.db.update("Recorrencia", valores, whereComparison, null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM