<% ID = request.querystring("ID") distributorID = request.querystring("distributorID") set objDB = OpenDatabase(false) SQL = "Select * from DistributorContentSections where ID = '" & ID & "'" set rsSection = CreateRecordset(objDB, SQL) currentorder = rsSection("DisplayOrder") if request.querystring("order") = "up" then SQL = "Select * from DistributorContentSections where DisplayOrder = " & currentorder - 1 & " AND DistributorID = '" & rsSection("DistributorID") & "'" set rsNewSection = CreateRecordset(objDB, SQL) neworder = rsNewSection("DisplayOrder") sectionID = rsSection("ID") SQL = "Update DistributorContentSections set DisplayOrder = " & neworder & " where ID = '" & sectionID & "'" UpdateDB objDB, SQL newsectionID = rsNewSection("ID") SQL = "Update DistributorContentSections set DisplayOrder = " & currentorder & " where ID = '" & newsectionID & "'" UpdateDB objDB, SQL else SQL = "Select * from DistributorContentSections where DisplayOrder = " & currentorder + 1 & " AND DistributorID = '" & rsSection("DistributorID") & "'" set rsNewSection = CreateRecordset(objDB, SQL) neworder = rsNewSection("DisplayOrder") sectionID = rsSection("ID") SQL = "Update DistributorContentSections set DisplayOrder = " & neworder & " where ID = '" & ID & "'" UpdateDB objDB, SQL newsectionID = rsNewSection("ID") SQL = "Update DistributorContentSections set DisplayOrder = " & currentorder & " where ID = '" & newsectionID & "'" UpdateDB objDB, SQL end if rsNewSection.close set rsNewSection = nothing rsSection.close set rsSection = nothing objDB.close set objDB = nothing response.redirect("../distributorcontent.asp?distributorID="&distributorID) %>