Unable to fetch data while Query excuting in android Sqlite -
public string[] getnewslink(string prodcuttye) { cursor cursor = mdb.query(sqlite_table, new string[] { "productname" }, "prodcttype='" + prodcuttye + "'", null, null, null, null, null); string[] result = new string[cursor.getcount()]; int = 0; if (cursor.movetofirst()) { { result[i] = cursor.getstring(cursor.getcolumnindex("productname")); i++; } while (cursor.movetonext()); } if ((cursor != null) && !cursor.isclosed()) { cursor.close(); mdb.close(); } return result; }
this function fetch data in string array trying excute query getting data when call in sqlite browser[ select productname myshopingtable prodcttype= 'basmati rice'] when try run query in function getting cursor count 0 unable data please tell me doing wrong please suggest me
try changing query following :
cursor c = mdb.query("select * myshopingtable prodcttype = ?",new string[]{prodcuttye})
see if works in case...
Comments
Post a Comment