dimanche 3 mai 2015

Sqlite Android RawQuery selectargs

The second Parameter of Rawquery seems not to work. My String Array looks like this:

String selec1 = "pd_infochar2";
String selec2 = "pd_infochar3";
String selec3 = "pd_infochar4";
String selec4 = "pd_infochar5";
String[] argswhere = new String[] {selec1,
                selec2, selec3, selec4};

My query looks like this:

String selectQuery = "SELECT  * FROM plant_data WHERE ((pd_infochar2=?) AND (pd_infochar3=?) AND (pd_infochar4=?) AND (pd_infochar5=?))";

And now i create the Cursor.

Cursor cursor = database.rawQuery(selectQuery, argswhere);

I read similar questions & answers already, but for me it looks like i have done everything right. When i use the above Code no line will be returned. If i set the second parameter of Rawquery to null and in the query i replace the ? with the Parameters from the Rawquery String[] everything works. Whats wrong?

Aucun commentaire:

Enregistrer un commentaire