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

i am sakshi.
i am creating a c#.net windows based project with ms sql 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 primary key 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
Comments
Kschuler 22-Jun-10 11:14am    
I don't think it's very wise to change a primary key like that. You'd have update the key in all files that join to it or else you've lost your connection. You might want to rethink your strategy and just display 1,2,3,4 when behind the scenes the key remains the same.

1 solution

Why do you want it that way?
It is not advisable to change your primary key. One of the other options would be to handle it on front end.
Explain your scenario and we could help better.
 
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