Help with update query
Posted on 2012-08-15
I have a TreeView in vb.net and when I take a node and drag it over another node..I want the order to be change. it works well in vb.net because I remove and insert the node correctly. but in the database it needs to change also becasue If I reload the Treeview i need to see the new order.
My table looks like this:
Code Description Sequence
ABC Test 1
ABC1 Test1 2
ABC2 Test2 3
ABC3 Test3 4
Lets say I take the node ABC and Drag on the node ABC3
I need ABC in the table to be "after" ABC3 I would like to modify the Sequence that the result is:
same thing reverse... lets say now we take ABC3 move to node ABC1, I need to update to that ABC3 be After ABC1 like this:
how can I do a query update for that? Im confused with the new Sequence, old sequence +1 .... -1... update the others to fit....
can you help?