insert and shift rows in database

Put your problem here if it does not fit any of the other categories.

insert and shift rows in database

Postby noRema » Tue Apr 12, 2011 2:03 pm


I'm using an SQL Lite database and I've got it working so I can insert, delete and update entries to the database. However I want to be able to insert a new entry into the database at a specific row index, and when I do this I want all rows below this index to shift down one position; as though you are inserting into a list.

This is because when I the display the contents on the database in my ListActivity class, it's easier to display it in the order the database rows are in.

I could shift the rows down one from index 'X' manually via inserting a new row at the end and then updating the rows after 'x' with the contents of the previous row index and then set my data on the desired row index. But I thought there would be a function to do this for you but I can't find one.

Is there one?

Posts: 2
Joined: Fri Jan 21, 2011 12:05 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 8 guests