vou te explicar andre
//dessa maneira não funciona
// String query = "SELECT _id, acess_nome, acess_tag, acess_pdf, acess_video, acess_thumb FROM tbl_acessoria where acess_tag LIKE '%?%'"
// String query = "SELECT _id, acess_nome, acess_tag, acess_pdf, acess_video, acess_thumb FROM tbl_acessoria where acess_tag LIKE '%?%'"
//dessa maneira funciona com este probleminha
public Cursor getAcessoriaSearchDB(Context context, String search) {
// TODO Auto-generated method stub
String where = "acess_tag LIKE ?";
String[] whereArgs = new String[] { "%" + search + "%" };
String[] query = {"_id, acess_nome, acess_tag, acess_pdf, acess_video, acess_thumb"};
String table = "tbl_acessoria";
return this.myDataBase.query(true, table, query, null, whereArgs, where, null, null, null);
}
tenho 4 produtos no banco.// TODO Auto-generated method stub
String where = "acess_tag LIKE ?";
String[] whereArgs = new String[] { "%" + search + "%" };
String[] query = {"_id, acess_nome, acess_tag, acess_pdf, acess_video, acess_thumb"};
String table = "tbl_acessoria";
return this.myDataBase.query(true, table, query, null, whereArgs, where, null, null, null);
}
1 acess_tag = "LLLLL"
2 acess_tag = "maizena"
3 acess_tag = "brigadeiro"
4 acess_tag = "cachoro"
Em 2 de junho de 2013 10:28, Andre Souza <deh.osouza@gmail.com> escreveu:
Vc pode exemplificar? Tipo, o que eh q vc ta passando no like e os resultados q tão vindo. Vc tem q saber que quando usa o comando LIKE '%SUA_CONSULTA%' ele vai trazer todos os resultados que tenham em qualquer posição aquela string q vc passou. Por exemplo, digamos que eu tenha 4 nomes no meu bd, Andre, Joao, Jessica e Jose. Se eu fizer uma consulta SELECT * FROM TB_PESSOA WHERE NOME LIKE '%e%' o resultado será Andre, Jessica e Jose, pois todos esses nomes possuem a letra 'E' em alguma posição.
--
You received this message because you are subscribed to a topic in the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/androidbrasil-dev/cSxAJaX-gNs/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário