<% ID = request.querystring("ID") set objDB = OpenDatabase(false) SQL = "Select * from ContentSections where ID = '" & ID & "'" set rsSection = CreateRecordset(objDB, SQL) currentorder = rsSection("DisplayOrder") if request.querystring("order") = "up" then SQL = "Select * from ContentSections where DisplayOrder = " & currentorder - 1 set rsNewSection = CreateRecordset(objDB, SQL) neworder = rsNewSection("DisplayOrder") sectionID = rsSection("ID") SQL = "Update ContentSections set DisplayOrder = " & neworder & " where ID = '" & sectionID & "'" UpdateDB objDB, SQL newsectionID = rsNewSection("ID") SQL = "Update ContentSections set DisplayOrder = " & currentorder & " where ID = '" & newsectionID & "'" UpdateDB objDB, SQL else SQL = "Select * from ContentSections where DisplayOrder = " & currentorder + 1 set rsNewSection = CreateRecordset(objDB, SQL) neworder = rsNewSection("DisplayOrder") sectionID = rsSection("ID") SQL = "Update ContentSections set DisplayOrder = " & neworder & " where ID = '" & ID & "'" UpdateDB objDB, SQL newsectionID = rsNewSection("ID") SQL = "Update ContentSections 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("../content.asp?show=content") %>