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
Post a Comment