title: Android: android.database.sqlite.SQLiteException: no such column
body: <pre><code>Cursor cursor = db.query(UserTable, null, 
                  "UserName=?", new String[] {username}, 
                  null, null, AccessedDate);
  </code></pre>
  
  <p>I am getting this no column found exception when i am trying to open my activity. The error points to the above<code>query line</code>.</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to start activity
    ComponentInfo{com.text.sample/com.text.sample.usercontext.RecentsActivity}:
    android.database.sqlite.SQLiteException: no such column: UserName
    (code 1): , while compiling: SELECT * FROM Patient WHERE UserName=?
    ORDER BY AccessedDate     at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
      at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
      at android.app.ActivityThread.access$600(ActivityThread.java:141) 
      at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
      at android.os.Handler.dispatchMessage(Handler.java:99)      at
    android.os.Looper.loop(Looper.java:137)   at
    android.app.ActivityThread.main(ActivityThread.java:5041)     at
    java.lang.reflect.Method.invokeNative(Native Method)      at
    java.lang.reflect.Method.invoke(Method.java:511)      at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)     at
    dalvik.system.NativeStart.main(Native Method)  Caused by:
    android.database.sqlite.SQLiteException: no such column: UserName
    (code 1): , while compiling: SELECT * FROM Patient WHERE UserName=?
    ORDER BY AccessedDate     at
    android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native
    Method)   at
    android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:882)
      at
    android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:493)
      at
    android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) 
      at
    android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58) 
      at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37) 
      at
    android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
      at
    android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
      at
    android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1161)
      at
    android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1032)
      at
    android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1200)
      at com.text.sample.common.DAL.getAllPatients(DAL.java:104)      at
    com.text.sample.usercontext.RecentsActivity.onCreate(RecentsActivity.java:38)
      at android.app.Activity.performCreate(Activity.java:5104)   at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
      at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
      ... 11 more</p>
  </blockquote>