If the id in the link the 11 or 12 is then used to reference an id in the 
database which is an id field in the DAL definition sense then the database 
engine will usually block you. The id field at the database level is meant 
to be a non repeating key so reuse of an id numeric value is discouraged and 
most often prevented by the database engine.

Having said that many databases allow for a way around that - look at the 
output of mysqldump or pg_dump if you happen to use MySQL or PostgreSQL and 
you will see they use special commands to defeat the autonumber or sequence 
feature while loading the data. The problem of course with disabling 
autonumber fields and updating is this possibly forms a relation to foreign 
keys in other tables.

If you look at the db.export_to_csv_file and db.import_from_csv_file it will 
pack the id fields down when you load the exported data back into a database 
created with tables and relations defined but no data inserted.

If you are dependent on your id fields being contiguous in order to create 
next and previous links then I think you need to reconsider. Perhaps a 
select of all ids in the table ordered by id, find the one you are currently 
on in the list and back up one or move forward one and then use that number. 
Every time you delete there will be a hole in the sequence where that item 
used to be.

Reply via email to