sql - Sqlite query returns no value Android -


i have sql query not returning value, has data returned. following query code

cursor cursor = db.query(crimedb.nome_tabela, crimedb.colunas,             crimedb.id_cidade + "=" + idcidade + "" + " , "                     + crimedb.time + " >= datetime('" + datainicioformatada                     + "') , " + crimedb.time + " <= datetime('"                     + datafimformatada + "')" + " , "                     + crimedb.grupo_crime + "=" + idcategoria + "", null,             null, null, null); 

read cursor

if (cursor.movetofirst()) {          {             crime = new crime();             crime.setlastupadatetoken(ultimotokenvalido                     .getultimotokenatualizado());              listcrime.add(itemcrime);          } while (cursor.movetonext());      } 

the query result is:

    select             grupo_crime_id_grupo_crime,      id_crime,      cities_id_cities,      time       crime       cities_id_cities=1650 ,      time >= datetime('20-10-2012') ,      time <= datetime('22-05-2014') ,      grupo_crime_id_grupo_crime=1 

was returns realize value because there value in database. using sqlite editor see register on table crime.

id_crime | cities_id_cities | grupo_crime_id_grupo_crime | time 1          1650               1                            28-03-2013 2          1650               1                            06-04-2013 

change date format yyyy/mm/dd , try using between instead of comparing dates >= , <=.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -