mercredi 11 février 2015

SQLite rawQuery Select columns whose titles are real numbers

I have a table whose columns have numbers:


Table name "Valores"


id Nombre 11 18 12.3

01 Juan 10 08 15

02 Rosa 23 51 61

03 Pepe 35 18 11


I want to know the amount you have chosen any name in the column. Example to Rosa in the column 12.3 is 61. I made the following statements:



columna = (EditText) findViewById(R.id.eT_columna);
valor = (EditText) findViewById(R.id.eT_valor);
String stColumna = columna.getText().toString();

public void consulta (View v){

//Determinación del valor
Cursor fila_valores = bd_valores.rawQuery(
"select "+ stColumna + " from Valores where Nombre", null);
if (fila_valores.moveToFirst()) {
valor.setText(fila_valores.getString(0));
}
bd_valores.close();
}


to run the application I get as a result 12.3 (correct value 61). What is my mistake ?. Thank You (sorry for my English)


Aucun commentaire:

Enregistrer un commentaire