The question can surely sound very noob. But hey, it turns out that I want to execute a simple where with dates. I tried everything (until I changed the column from type DATE to type TEXT) and I still have no results.
Cursor curs = admin.selectWhere(DBScheme.Tabla_Asignaciones,new String[]{
DBScheme.Columna_IdMateria,
DBScheme.Columna_Descripcion,
DBScheme.Columna_Fecha_Creacion,
DBScheme.Columna_Fecha_Inicio,
DBScheme.Columna_Fecha_Expiracion,
DBScheme.Columna_Entregado},
DBScheme.Columna_Fecha_Expiracion + "=?",
new String[]{tiempo.getFecha(dia)});
The part of the time.getDate (day) , is a function that returns the date (with the format yyyy-MM-dd) passing it as parameter the day of the week (Monday, Friday, Sunday ...)
It gives me something like this: 2017-12-25 for example. By the way, although I write it directly ("2017-12-25") it still does not work ... it returns 0 rows.
Update
The functions I use to execute queries:
public Cursor selectLog(String query){
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor;
cursor = db.rawQuery(query,null);
return cursor;
}
public Cursor selectWhere(String table,String[]columns, String whereCols, String[]whereArgs){
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(table,columns,whereCols,whereArgs,null,null,null);
return cursor;
}
With the last suggestion that they gave me, by the way, the first code that I showed of this question, is as follows:
Cursor curs = admin.selectLog("SELECT * FROM " + DBScheme.Tabla_Asignaciones +
" WHERE " + DBScheme.Columna_Fecha_Expiracion + "='" + tiempo.getFecha(dia) + "'");