c# - Auto update primary key after deleting information -
Anyone know how to solve this ID problem?
For example:
id | Message 1 | Hello 2 Philemon 3 | Car & lt; - Delete this line 4. Fixed 5 Bye When you delete the third line, the ID will automatically update the update and the ID after the line.
id Message 1 | Hello 2 Philemon 3 | Fix 4 BE More info:
Private zeros btnDel_Click {Object Sender, EventArgs E} {use (testEntities Setupctx = new testEntities ()) {int id = Int32.Parse (lblID.Text); Var DeleteSh = (Setupctx.shifthours in delsh, select delsh.idShiftHours == ID delsh). Single (); Setupctx.DeleteObject (DeleteSh); Setupctx.SaveChanges (); TxtStart.Text = ""; TxtStop.Text = ""; This.Edit_Shift_Hours_Load (empty, EventArgs.Empty); MessageBox.Show ("The selected shift time has been removed."); }} This line is a code to delete, after deleting it, I need an ID to auto update so that it fills the deleted ID in the next data. Currently I am able to delete the information but the ID is identical.
Do no do so, suppose someone links to your page And, before you delete some indexes, suddenly some of the 1234 references are completely different. This will be a concurrency and usable nightmare.
Comments
Post a Comment