android - Pass id int into query -


i have query pass parameters groupid, query not recognize number(group id).all values reaching query( debugged). query, can see if structure ok?

public cursor updategrupo(string nomegrupo,int idgroup){ sqlitedatabase db = this.getreadabledatabase(); //does not put id in "idgroup" cursor c = db.rawquery("update  '"+tablegrupo+"' set '"+nomegrupo+"' = '"+nomegrupo+"' '"+idgrupo+"' = '"+idgroup+"'", new string[]{}); return c; } 

  1. you should use sqlitedatabase writable mode getwritabledatabase().
  2. you should use below method updating data:

    update(string table, contentvalues values, string whereclause, string[] whereargs)

try this:

public void updategrupo(string nomegrupo,int idgroup) {     sqlitedatabase db = this.getwritabledatabase();      contentvalues values = new contentvalues();      values.put(nomegrupo, nomegrupo);      db.update(tablegrupo, values, idgrupo + " = ? " , new string[]{string.valueof(idgroup)}); } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -