Hello,
I am trying to sort table columns but it kept generating the errors by showing the black page when I click on the column's names to sort.
When I clicked on "Cars", it showed black page (not found) and the url is like this:
default?sortby=Cars&Cars=&sortOrder=asc&alpha=
And the error page is:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Can anyone please tell me how to fix it?
Thank you very much!
Code:
<%
Dim sAlpha, Cars, DateShippedSold, DateSubmitted
Dim sortOrder: sortOrder = request.querystring("sortOrder")
Dim sortby: sortby = request.querystring("sortby")
select case sortOrder
case "asc"
sortOrder = "desc"
case "desc"
sortOrder = "asc"
case else
sortOrder = "asc"
end select
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT ID, Cars, DateShippedSold, DateSubmitted " & _
" FROM tblCars "
If (len(sAlpha) > 0) Then _
strsql = strsql & " where "&sortby&" like '"&sAlpha&"%'"
if len(sortby) > 0 then _
strsql = strsql & " order by "&sortby&" " & sortOrder
oRs.Open strSQL, myConn
%>
<table>
<tr>
<td><a href="default?sortby=Cars&Cars=<%=Cars%>&sortOrder=<%=sortOrder%>&alpha=<%=sAlpha%>">Cars</a><% if (sortby = "Cars") then response.write "<span style=""color:red;"">*</span>" end if %></td>
<th><a href="default?sortby=Shipped&Shipped=<%=DateShippedSold%>&sortOrder=<%=sortOrder%>&alpha=<%=sAlpha%>">Shipped</a><% if (sortby = "Shipped") then response.write "<span style=""color:red;"">*</span>" end if %></th>
<th><a href="default?sortby=Submitted&Submitted=<%=DateSubmitted%>&sortOrder=<%=sortOrder%>&alpha=<%=sAlpha%>">Submitted</a><% if (sortby = "Submitted") then response.write "<span style=""color:red;"">*</span>" end if %></th>
</tr>
<% While Not oRs.EOF %>
<tbody id="offTblBdy">
<tr>
<td><a href="detail.asp?ID=<%=oRs("ID")%>"><%=oRs("Cars")%></a></td>
<td><%=oRs("DateShippedSold")%></td>
<td><%=oRs("DateSubmitted")%></td>
</tr>
<%
oRs.MoveNext
WEND
%>
__________________
Life is short, try to do something good!
|