title: Error in SQLiteDatabase Android
body: <p>Currently Im am implementing SQLiteDatabase into my android application. So i wanted to create a table called TABLE_LOGIN and store all the data of the login user but i met with a error saying 1 of the column doesnt exist. I check and i did put the column when the table is created
  Below is my code:</p>
  
  <pre><code>// Login Table Columns names
  private static final String KEY_ID = "id";
  private static final String KEY_NAME = "name";
  private static final String KEY_CNAME = "cname";
  private static final String KEY_EMAIL = "email";
  private static final String KEY_UID = "uid";
  private static final String KEY_CREATED_AT = "created_at";
  
  public void onCreate(SQLiteDatabase db) {
      String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "("
              + KEY_ID + " INTEGER PRIMARY KEY," 
              + KEY_NAME + " TEXT,"
              + KEY_CNAME + " TEXT,"
              + KEY_EMAIL + " TEXT UNIQUE,"
              + KEY_UID + " TEXT,"
              + KEY_CREATED_AT + " TEXT" + ")";
      db.execSQL(CREATE_LOGIN_TABLE);
  }
  </code></pre>
  
  <p>This is my logcat:</p>
  
  <pre><code>08-27 01:29:57.336: E/JSON(531): {"tag":"login","success":1,"error":0,"uid":"5033b1eeedde88.60881196","user":{"name":"a","cname":"a","email":"a@gmail.com","created_at":"2012-08-22 00:06:06","updated_at":null}}
  08-27 01:29:57.486: E/Database(531): Error inserting uid=5033b1eeedde88.60881196 created_at=2012-08-22 00:06:06 email=a@gmail.com cname=a name=a
  08-27 01:29:57.486: E/Database(531): android.database.sqlite.SQLiteException: table login has no column named cname: , while compiling: INSERT INTO login(uid, created_at, email, cname, name) VALUES(?, ?, ?, ?, ?);
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteCompiledSql.&lt;init&gt;(SQLiteCompiledSql.java:64)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:80)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:36)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteDatabase.compileStatement(SQLiteDatabase.java:1145)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1536)
  08-27 01:29:57.486: E/Database(531):    at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1410)
  08-27 01:29:57.486: E/Database(531):    at com.stts.sparetimetradingsystem.library.DatabaseHandlerEmployer.addUser(DatabaseHandlerEmployer.java:72)
  08-27 01:29:57.486: E/Database(531):    at com.stts.sparetimetradingsystem.employer.LoginEmployerActivity$LoginEmployer$1.run(LoginEmployerActivity.java:129)
  08-27 01:29:57.486: E/Database(531):    at android.os.Handler.handleCallback(Handler.java:587)
  08-27 01:29:57.486: E/Database(531):    at android.os.Handler.dispatchMessage(Handler.java:92)
  08-27 01:29:57.486: E/Database(531):    at android.os.Looper.loop(Looper.java:123)
  08-27 01:29:57.486: E/Database(531):    at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-27 01:29:57.486: E/Database(531):    at java.lang.reflect.Method.invokeNative(Native Method)
  08-27 01:29:57.486: E/Database(531):    at java.lang.reflect.Method.invoke(Method.java:521)
  08-27 01:29:57.486: E/Database(531):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  08-27 01:29:57.486: E/Database(531):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  08-27 01:29:57.486: E/Database(531):    at dalvik.system.NativeStart.main(Native Method)
  08-27 01:29:58.736: E/AndroidRuntime(531): FATAL EXCEPTION: main
  08-27 01:29:58.736: E/AndroidRuntime(531): java.lang.RuntimeException: Unable to destroy activity {com.stts.sparetimetradingsystem/com.stts.sparetimetradingsystem.employer.HomepageEmployerActivity}: java.lang.NullPointerException
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3655)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3673)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread.access$2900(ActivityThread.java:125)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.os.Handler.dispatchMessage(Handler.java:99)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.os.Looper.loop(Looper.java:123)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at java.lang.reflect.Method.invokeNative(Native Method)
  -27 01:29:58.736: E/AndroidRuntime(531):    at java.lang.reflect.Method.invoke(Method.java:521)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at dalvik.system.NativeStart.main(Native Method)
  08-27 01:29:58.736: E/AndroidRuntime(531): Caused by: java.lang.NullPointerException
  08-27 01:29:58.736: E/AndroidRuntime(531):  at com.stts.sparetimetradingsystem.employer.HomepageEmployerActivity.onDestroy(HomepageEmployerActivity.java:315)
  08-27 01:29:58.736: E/AndroidRuntime(531):  at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3642)
  08-27 01:29:58.736: E/AndroidRuntime(531):  ... 11 more
  </code></pre>
  
  <p><em><strong>EDIT</em></strong> INSERT USER DATA CODE: </p>
  
  <pre><code>public void addUser(String name, String cname, String email, String uid, String created_at) {
          SQLiteDatabase db = this.getWritableDatabase();
  
          ContentValues values = new ContentValues();
          values.put(KEY_NAME, name); // Name
          values.put(KEY_CNAME, cname); // CName
          values.put(KEY_EMAIL, email); // Email
          values.put(KEY_UID, uid); // UID
          values.put(KEY_CREATED_AT, created_at); // Created At
  
          // Inserting Row
          db.insert(TABLE_LOGIN, null, values);
          db.close(); // Closing database connection
      }
  </code></pre>