skal flytte en post i en database op eller ned
Er der nogle der kan fortælle mig hvorfor dette kun virker nogle gange????Jeg kalder siden med
Hvis jeg vil flytte den ned
orderby.asp?SectionID=<%= rsSection("SectionID")%>&Down=1&Odby=<%= rsSection("Odby")%>
Hvis jeg vil flytte den op
orderby.asp?SectionID=<%= rsSection("SectionID")%>&Up=1&Odby=<%= rsSection("Odby")%>
<%
strSectionID = Request("SectionID")
strUp = Request("Up")
strDown = Request("Down")
strOdby = Request("Odby")
If strDown <> "" Then
strOdby1 = strOdby + 1
Set conn = Server.CreateObject("ADODB.Connection")
connString = "DBQ=" & Server.Mappath("../../../../../database/pages.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
conn.open connString
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM Section WHERE SectionID=" & strSectionID
rs.open sql, conn, 1, 3
rs.Update
rs("Odby") = strOdby1
rs.Update
rs.Close
Set conn = Server.CreateObject("ADODB.Connection")
connString = "DBQ=" & Server.Mappath("../../../../../database/pages.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
conn.open connString
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM Section WHERE MenuID =" & Session("MenuID") & " and Odby =" & strOdby1
rs.open sql, conn, 1, 3
rs.Update
rs("Odby") = strOdby
rs.Update
rs.Close
end if
If strUp <> "" Then
strOdby1 = strOdby - 1
Set conn = Server.CreateObject("ADODB.Connection")
connString = "DBQ=" & Server.Mappath("../../../../../database/pages.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
conn.open connString
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM Section WHERE SectionID=" & strSectionID
rs.open sql, conn, 1, 3
rs.Update
rs("Odby") = strOdby1
rs.Update
rs.Close
Set conn = Server.CreateObject("ADODB.Connection")
connString = "DBQ=" & Server.Mappath("../../../../../database/pages.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
conn.open connString
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM Section WHERE MenuID =" & Session("MenuID") & " and Odby =" & strOdby1
rs.open sql, conn, 1, 3
rs.Update
rs("Odby") = strOdby
rs.Update
rs.Close
end if
Response.redirect "/pages/pages.asp"
%>
