Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Sqlite query
    text
    copied!<p>My requirement is when I pass some paramenter query need to send object. not list.</p> <p>I have written the code :</p> <pre><code> public RDExecutive getExecutiveObject(String executivename){ DBAdapter dbAdapter = DBAdapter.getDBAdapterInstance(this); dbAdapter.openDataBase(); System.out.println( " ---- executivename --- " + executivename); String query="SELECT * FROM RDExecutive WHERE ExecutiveName = ?';"; String[]d = new String[]{executivename}; ArrayList stringList = dbAdapter.selectRecordsFromDBList(query, d); dbAdapter.close(); ArrayList&lt;Object&gt; rdExecutiveObject = new ArrayList&lt;Object&gt;(); RDExecutive rdExecutive = new RDExecutive(); System.out.println( " -- stringList.size() -- " + stringList.size()); for (int i = 0; i &lt; stringList.size(); i++) { ArrayList&lt;Object&gt; arrayList2 = (ArrayList&lt;Object&gt;) stringList.get(i); ArrayList&lt;Object&gt; arrayList = arrayList2; ArrayList&lt;Object&gt; list = arrayList; try { rdExecutive.setBusinessUnit((String) list.get(0)); rdExecutive.setExecutiveCode((String) list.get(1)); rdExecutive.setExecutiveName((String) list.get(2)); rdExecutive.setTerritoryCode((String) list.get(10)); } catch (Exception e) { Log.i("***" + SalesRouteActivity.class.toString(), e.getMessage()); } rdExecutiveObject.add(rdExecutive); } return rdExecutive; } </code></pre> <p>This method is return RDExecutive object.</p> <p>When I run this part , I got error</p> <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xont.controller/com.xont.controller.DownlaodTableActivity}: android.database.sqlite.SQLiteException: unrecognized token: "';": , while compiling: SELECT * FROM RDExecutive WHERE ExecutiveName = ?'; </code></pre> <p>How do we want to pass parameter to query.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload