Note that there are some explanatory texts on larger screens.

plurals
  1. POalter table code in android...
    text
    copied!<p>following is the code that i used to alter my table but my app is crashing.</p> <p>I have create this <code>dbupdateadapter</code> class separately. the records are being added, but the column is not added to the same table</p> <pre><code>public class dbupdateadapter { public static final String TABLE_MEMBERID="memberid"; private static final String DATABASE_NAME="myfemmefab.db"; private static final String TABLE_NAME="registeration"; private static final int DATABASE_VERSION=2; private static final String DATABASE_UPDATE="ALTER TABLE registeration ADD COLUMN(memberid TEXT);"; private static Context context1; private dbhelper1 helper1; private SQLiteDatabase sdb1; public dbupdateadapter(Context con){ this.context1=con; helper1=new dbhelper1(context1); } public class dbhelper1 extends SQLiteOpenHelper{ public dbhelper1(Context context){ super(context,DATABASE_NAME,null,DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase sdb1){ sdb1.execSQL(DATABASE_UPDATE); } @Override public void onUpgrade(SQLiteDatabase sdb1,int oldver,int newver){ //android.util.Log.w("constants", "upgrading database will destroy the old data"); if(newver&gt;oldver){ sdb1.execSQL(DATABASE_UPDATE); } //onCreate(sdb1); } } public dbupdateadapter open() throws SQLException{ sdb1=helper1.getWritableDatabase(); return this; } void insertcoldata (String memberid){ ContentValues cv1=new ContentValues(); cv1.put(TABLE_MEMBERID, memberid); sdb1.insert(TABLE_NAME, null, cv1); } public void close(){ helper1.close(); } } </code></pre>
 

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