title: E/SQLiteLog﹕ (1) no such column: nmb
body: <p>When I try to run my app, it crashes.</p>
  
  <pre><code>E/SQLiteLog﹕ (1) no such column: nmb
  </code></pre>
  
  <p>Here's my DB code</p>
  
  <pre><code>private static final String DB_NAME = "mydb";
  private static final int DB_VERSION = 4;
  private static final String DB_TABLE = "mytab";
  
  public static final String COLUMN_ID = "_id";
  public static final String COLUMN_IMG = "img";
  public static final String COLUMN_TXT = "txt";
  public static final String COLUMN_NMB = "nmb";
  
  private static final String DB_CREATE =
          "create table " + DB_TABLE + "(" +
                  COLUMN_ID + " integer primary key autoincrement, " +
                  COLUMN_IMG + " integer, " +
                  COLUMN_TXT + " text, " +
                  COLUMN_NMB + " number" +
                  ");";
  
  private final Context mCtx;
  
  
  private DBHelper mDBHelper;
  private SQLiteDatabase mDB1;
  
  public DB2(Context ctx) {
      mCtx = ctx;
  }
  
  public void open() {
      mDBHelper = new DBHelper(mCtx, DB_NAME, null, DB_VERSION);
      mDB1 = mDBHelper.getWritableDatabase();
  }
  
  public void close() {
      if (mDBHelper!=null) mDBHelper.close();
  }
  
  
  
  public Cursor getAllData() {
      String[] columns = {"_id","txt","img","nmb"};
      return mDB1.query(DB_TABLE, columns, null, null, null, null, null);
  }
  
  public void addRec(String txt, int img, String nmb) {
      ContentValues cv = new ContentValues();
      cv.put(COLUMN_TXT, txt);
      cv.put(COLUMN_IMG, img);
      cv.put(COLUMN_NMB, nmb);
      mDB1.insert(DB_TABLE, null, cv);
  }
  
  public void delRec(long id) {
      mDB1.delete(DB_TABLE, COLUMN_ID + " = " + id, null);
  }
  
  private class DBHelper extends SQLiteOpenHelper {
  
      public DBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory,
                      int version) {
          super(context, name, factory, version);
      }
  
      @Override
      public void onCreate(SQLiteDatabase db) {
          db.execSQL(DB_CREATE);
  
      }
  
      @Override
      public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      }
  }
  </code></pre>
  
  <p>This is my activity code</p>
  
  <pre><code>private static final int CM_DELETE_ID = 1;
  ListView lvData;
  DB2 db;
  SimpleCursorAdapter scAdapter;
  Cursor cursor;
  EditText et,nmb;
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_test4);
      et =(EditText)findViewById(R.id.editText2);
      nmb = (EditText)findViewById(R.id.nmb);
      db = new DB2(this);
      db.open();
  
      cursor = db.getAllData();
      startManagingCursor(cursor);
  
      String[] from = new String[] { DB2.COLUMN_IMG, DB2.COLUMN_TXT, DB2.COLUMN_NMB };
      int[] to = new int[] { R.id.ivImg, R.id.tvText, R.id.tvNmb };
  
      scAdapter = new SimpleCursorAdapter(this, R.layout.item, cursor, from, to);
      lvData = (ListView) findViewById(R.id.lvData);
      lvData.setAdapter(scAdapter);
  
      registerForContextMenu(lvData);
  
  }
  
  
  
  public void onButtonClick(View view) {
      db.addRec(et.getText().toString(), R.mipmap.ic_launcher, nmb.getText().toString());
      cursor.requery();
  }
  
  public void onCreateContextMenu(ContextMenu menu, View v,
                                  ContextMenu.ContextMenuInfo menuInfo) {
      super.onCreateContextMenu(menu, v, menuInfo);
      menu.add(0, CM_DELETE_ID, 0, R.string.delete_record);
  }
  
  public boolean onContextItemSelected(MenuItem item) {
      if (item.getItemId() == CM_DELETE_ID) {
          AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
          db.delRec(acmi.id);
          cursor.requery();
          return true;
      }
      return super.onContextItemSelected(item);
  }
  
  protected void onDestroy() {
      super.onDestroy();
      db.close();
  }
  </code></pre>
  
  <p>In my first DB_VERSION, I didn't have COLUMN_NMB and it was working. Also in "getAllData()" cursor public I only had return mDB1.query(DB_TABLE, null, null, null, null, null, null);. After I've added nmb string, it keeps crashing</p>