Yes I changed the VERSION number on both the dbHelper file as well as the 
manifest

below is the code for the db helper:

public class RecipeDbHelper extends SQLiteOpenHelper {


        private static final String DATABASE_NAME = "test";
        private static final String DATABASE_TABLE = "recipe";
        private static final int DATABASE_VERSION = 10;
        
        private static final String DATABASE_CREATE = "CREATE TABLE recipe ( 
_id INTEGER PRIMARY KEY, title text not null, ingredients text not null, 
instructions text not null, mealtime INTEGER not null, calories INTEGER not 
null);";
        
        private static final String INITIAL_SETUP = 
                "INSERT INTO recipe (_id, title, instructions,ingredients, 
mealtime, calories) "
                + "VALUES (1, 'Triple Veggie Scramble','1. Chop all veggies and 
set aside. Whisk eggs in bowl.\n2. Spray nonstick skillet with cooking spray 
and saute veggies until soft.\n3. Add whisked eggs, cheese and dash salt and 
pepper and cook until eggs are firm. \n4. Serve on toasted english muffin with 
sliced pear on the side.',"
                +"'3 eggs (1 whole + 2 whites) \n1\\2 cup each chopped 
tomatoes, spinach and mushrooms\n1 oz reduced fat shredded cheddar cheese\n1 
Thomas Light Multigrain english muffin\nSmall pear, sliced.\nsalt/pepper to 
taste', 1, 124);"
                ;
                
        public RecipeDbHelper(Context context){
                super(context, DATABASE_NAME, null, DATABASE_VERSION);
        }
        
        public void clearReset(SQLiteDatabase db) {
                Log.w("Upgrading", "Upgrading database from version");
                db.execSQL("DROP TABLE IF EXISTS "+ DATABASE_TABLE);
                onCreate(db);
        }
        
        @Override
        public void onCreate(SQLiteDatabase db){
                db.execSQL(DATABASE_CREATE);
                db.execSQL(INITIAL_SETUP);
        }
        
        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int 
newVersion){
                Log.w("Upgrading", "Upgrading database from version " + 
oldVersion + " to "
                + newVersion + ", which will destroy all old data");
        db.execSQL("DROP TABLE IF EXISTS "+ DATABASE_TABLE);
        onCreate(db);
        }

thanks again I truly appreciate it.

Albert Rosa
rosalb...@gmail.com
alb...@albert-rosa.com
(m) 718-825-7838
(aim) albertrosa2000
(gchat) rosalbert
(gvoice) (646) 389-7672

On May 3, 2011, at 4:18 AM, harsh chandel wrote:

> can you put the code
> 
> On May 3, 5:58 am, Albert Rosa <rosalb...@gmail.com> wrote:
>> So this is my first time working with android and the sqlite db. I followed
>> the instructions and was able to have a db connection where i was able to
>> create and edit records. However i changed the schema of the db just to make
>> it easier on me.
>> 
>> Here is when i get slapped, i updated the version number, and modified the
>> create statement to reflect the change. The onUpdate function is not being
>> hit when i run the app again.
>> 
>> Im not sure what I may be doing wrong. Any help suggestions are greatly
>> welcomed and appreciated.
>> 
>> Thanks for the help!
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to