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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -