Forums
This topic is locked
ASP.NET - call SQL
Posted 26 Apr 2004 17:57:12
1
has voted
26 Apr 2004 17:57:12 David Hagelthorn posted:
Help needed please!I'm trying to reorder a list of items by changing their rank number in an Access database (using DWMX2004) Each item is ranked and then ordered by rank in the display page. In the admin section, I want to move the position of the items by clicking on up and down arrows (rather than manually typing in the new rank number for every item). The code I have is:
<pre id=code><font face=courier size=2 id=code>
Dim sql As String
Dim rank As Int32
Dim newrank As Int32
If (Request.QueryString("action"="moveUp" Then
rank = Request.QueryString("rank"
newrank = rank - 1
sql = "update tbl_casestudies set csrank = csrank + 1 where csrank >="+newrank.ToString()
' run sql
sql = "update tbl_casestudies set csrank = " + newrank.ToString() + " where csrank = " + rank.ToString()
' run sql
End If
If (Request.QueryString("action"="moveDown" Then
rank = Request.QueryString("rank"
newrank = rank + 1
sql = "update tbl_casestudies set csrank = csrank - 1 where csrank <="+newrank.ToString()
' run sql
sql = "update tbl_casestudies set csrank = " + newrank + " where csrank = " + rank.ToString()
' run sql
End If
</font id=code></pre id=code>
Edited by - dpchages on 26 Apr 2004 18:08:27