title: Select specified column from sqlite database and show to textview
body: <p>UPDATE!!!!</p>
  
  <p>I'm working with android sqlite database, I want to select a specified query using sql select statement with where clause like this "SELECT * FROM mytable WHERE name = 'Name'";</p>
  
  <p>but I don't success with, this is my code that works but don't contain any where clause.
  Thanks.</p>
  
  <pre><code>public String Read(String name)
  {
      String[] columns = new String[]{SQLiteHelper.COLUMN_NPM, SQLiteHelper.COLUMN_NAME};
      String selection = SQLiteHelper.COLUMN_NAME + " = " + name;
      String[] selectionArgs = {String.valueOf(name)};
      Cursor cursor = database.query(SQLiteHelper.TABLE_MHS, columns, selection, selectionArgs, null, null, null);
  
  
      cursor.moveToFirst();
      String index_name = cursor.getString(cursor.getColumnIndex(SQLiteHelper.COLUMN_NAME));
      return index_name;
  }
  </code></pre>
  
  <p>I put that code on my database source that extends sqliteopenhelper, but I got following error in log cat</p>
  
  <p><code>03-10 11:57:37.000: E/AndroidRuntime(14709): FATAL EXCEPTION: main
  03-10 11:57:37.000: E/AndroidRuntime(14709): android.database.sqlite.SQLiteException: no such column: radit: , while compiling: SELECT npm, name FROM Mhs WHERE name = radit
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteCompiledSql.&lt;init&gt;(SQLiteCompiledSql.java:65)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:83)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteQuery.&lt;init&gt;(SQLiteQuery.java:49)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:53)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1438)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1317)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1353)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at com.crud.MhsDataSource.Read(MhsDataSource.java:55)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at com.crud.MainActivity$4.onClick(MainActivity.java:76)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.view.View.performClick(View.java:2533)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.view.View$PerformClick.run(View.java:9320)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.os.Handler.handleCallback(Handler.java:587)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.os.Handler.dispatchMessage(Handler.java:92)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.os.Looper.loop(Looper.java:150)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at android.app.ActivityThread.main(ActivityThread.java:4389)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at java.lang.reflect.Method.invokeNative(Native Method)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at java.lang.reflect.Method.invoke(Method.java:507)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  03-10 11:57:37.000: E/AndroidRuntime(14709):    at dalvik.system.NativeStart.main(Native Method)
  </code></p>
  
  <p>I've got the answer, this is my code for SQLite select parameter</p>
  
  <pre><code>public String Read(String name)
  {
      String[] columns = new String[]{SQLiteHelper.COLUMN_NPM, SQLiteHelper.COLUMN_NAME};
      String selection = SQLiteHelper.COLUMN_NAME + " like ? ";
      String[] selectionArgs = {name};
      Cursor cursor = database.query(SQLiteHelper.TABLE_MHS, columns, selection, selectionArgs, null, null, null);
  
  
      cursor.moveToFirst();
      String index_name = cursor.getString(cursor.getColumnIndex(SQLiteHelper.COLUMN_NAME));
      String index_npm = cursor.getString(cursor.getColumnIndex(SQLiteHelper.COLUMN_NPM));
      String result = index_npm + " " + index_name;
      return result;
  }
  </code></pre>