title: How to perform a Sqlite query in android by using a search value in Android?
body: <p>I have been following the new boston series for Android and i wanted to try something. So, i wanted to enter a name in a edit text and retrieve the relevant details from the sqlite database. My code shows error and i am unable to fix it. Can anyone please suggest me what could be my mistake?</p>
  
  <p>Following is one of the method that is supposed to give me the item name by querying the Username in the edittext but it gives me error</p>
  
  <pre><code>public String getItemname(String l) throws SQLException{
          String[] columns = new String[]
                  {KEY_ROWID, KEY_NAME, KEY_INAME, KEY_ICODE, KEY_QUANTITY, KEY_DATE, KEY_TNAME};
          Cursor c = ourdatabase.query(DATABASE_TABLE,columns,KEY_NAME + "=" + l,null,null,null,null);
  
          if(c!= null)
          {
              c.moveToFirst();
              String itemname = c.getString(2);
              return itemname;
  
          }
  
          return null;
      }
  </code></pre>
  
  <p>Note:- I don't get any specific error pointing at a particular line of code but it just shows that the "Unfortunately Program has crashed"</p>