When i delete any value from database , i want to reorder the primary key again ..
how can i do it ?
FOR INSTANCE , if i delete 4th person Osman from database , in my access database , it converts
BUT I WANA DO NEW ORDER LIKE
HOW CAN I DO IT ?
Primary keys are meant to be used for joining tables together and indexing, they are not meant to be used for human usage. Reordering primary key columns could orphan data and wreck havoc to your queries.
Add another column to your table and reorder that column to your will (show that column to your user instead of the primary key).
No need to rearrange the Primary key, ListBox has two properties( value and text), bind the primary key field(ID) to value property and rebind the grid after deleting the records.
this.listBox1.DataSource = listToBind ;
this.listBox1.DisplayMember = "Text";
this.listBox1.ValueMember = "Id";
You can retrieve the selected value using the property.
Hope this will help you.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)