Click here to Skip to main content
15,887,289 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everybody,

i am Jyotin.
i am creating a vb windows based project with ms access database.
i am using delete query which is working well.
but my problem is------
i want to re-arrange the datatable after deletion.
as-i have rows having slno 1,2,3,4,5,6.
after delting 1,5 row,it becomes 2,3,4,6.
i want that it should be 1,2,3,4 means remaining rows should be re-arrange staring from 1.

please reply.

thanks alot.
Posted

1 solution

Well, the RowNumbers must be an Identity column and auto-incremental. If so, you cannot change it directly.

If, it is a RowNumbers are provided by you at time of insertion then you can try to change for all as you need. But then, you need to be careful to maintain referential integrity if any. (i.e. other tables referencing it must also be changed)

Now, How to do this for a table:
You can use Cursors to achieve it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900