mikha
asked on
updating order of the rows, N+1 query issue, C#, asp.net, MVC, SQL Server
I have a sql table like shown below. on the client side with Jquery, user can drag and drop rows in the table, to change the order of rows. on each row reorder event, i want to make a ajax call to update the order in the sql database. I have the id of the row that was moved, its old position and and new position. also i have the id, old and new position of the row that was moved because of the first row that took place of this one.
what would be a best way to determine, for what rows the order column needs to be updated in the database. Also, to update oder column for each row, i will need to run an update query in an for each loop. is there a better way of doing this?
Table Example{
id int,
name,
order int
}
what would be a best way to determine, for what rows the order column needs to be updated in the database. Also, to update oder column for each row, i will need to run an update query in an for each loop. is there a better way of doing this?
Table Example{
id int,
name,
order int
}
At one time the user will move one row correct?
ASKER
for now, yes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.