On further review, I think I am using the database object to insert a row. return mDb.insert(DATABASE_TABLE, null, initialValues); where mDb is the database returned by getWritableDatabase.
Any ideas why this would work the first time, but not create a new row the next time? It returns the same rowID each time until I restart. On Feb 23, 7:16 pm, Paul <[email protected]> wrote: > Thanks for the reply. > I meant android.database.sqlite.SQLiteOpenHelper . I'm using: > > long android.database.sqlite.SQLiteDatabase.insert(String table, > String nullColumnHack, ContentValues values) > > which returns a rowID for the new row. This works the first time but > not subsequent. > > I'll try using the direct approach - after I learn how to do this! > > On Feb 23, 6:14 pm, Brion Emde <[email protected]> wrote: > > > > > I'm confused with the terminology you're using. > > > What is Data Base Helper? There are a couple of them: > > SQLiteOpenHelper; SQLiteQueryHelper and just the plain old database. > > Your SQLiteOpenHelper can create stuff when you create your database, > > like if you need a table pre-populated. > > > The QueryHelper is for helping you build queries. Those are the > > helpers that I have used. > > > When I want to insert, delete or update a row in a table, I talk to > > the SQLiteDatabase object itself. > > > On Feb 22, 10:11 pm, Paul <[email protected]> wrote: > > > > I have a database that works fine to create a new row the first time > > > after I start the application, but subsequent times, data base helper > > > returns the same rowID and does not store a new row. It doesn't help > > > when leaving or returning to an activity or if I stop and start the > > > database. Do I need to do something to tell insert to ... insert? I > > > can work around by restarting the app, but there must be something > > > simple I'm missing. > > > > I've used the Notepad example database as my starting point. > > > > Any help would be appreciated. > > > Thanks, > > > Paul -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

