Reply
asp sort table columns show errors - please help
Old 02-25-2009, 10:35 AM asp sort table columns show errors - please help
tadisaus2's Avatar
Experienced Talker

Posts: 36
Trades: 0
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!
tadisaus2 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 02-25-2009, 01:54 PM Re: asp sort table columns show errors - please help
chrishirst's Avatar
Super Moderator

Posts: 22,223
Location: Blackpool. UK
Trades: 0
and do you have a page called "default"?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to asp sort table columns show errors - please help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11314 seconds with 13 queries