We help IT Professionals succeed at work.
Get Started

Help with update query

Last Modified: 2012-08-21
Hello EE,

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:

ABC1          1
ABC2          2
ABC3          3
ABC            4

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:

ABC1       1
ABC3       2
ABC2       3
ABC         4

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?
Watch Question
Project Architect
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE