I have class called Item which has Id ,Name column and Creating Item table in DB.
Suppose i have retrieve a table like this in DataGrid .
Id Name
1 pen
2 pencil
3 eraser
4 book
5 sharpener
If i delete Id having 3.Then after deleting Id should be in ascending Order.Like this and it should reflect in Datagrid after Deleting
Id Name
1 pen
2 pencil
3 book
4 sharpener
Kindly help!!

Jignesh TrivediPosted Sep 19, 2013, 6:55 AM
hi,
I think this may be achive by stored procedure
CREATE PROCEDURE DeleteRecord
(
@Id INT
)
BEGIN
DELETE ItemMaster where id = @Id
UPDATE ItemMaster
SET id = id -1
where id > @Id
END
hope this will help you.
Kiran Kumar TalikotiPosted Sep 19, 2013, 3:50 AM
Id is the Primary Key.If i delete 1 Id and remaining Ids should arrange in ascending order?
As i show in 2nd table
Iftikar HussainPosted Sep 19, 2013, 3:02 AM
Is the ID column is identity column?
Regards,
Iftikar