troubleshooting Question

How to SQL sort the table in classic asp where data is retrieved from database?

Avatar of Bade011
Bade011 asked on
JavaScriptASPHTMLJSON
1 Comment1 Solution437 ViewsLast Modified:
Hi Experts,
 I am trying to sort a table's date (by ascending and descending)and author name alphabetically. I have heard of "table sorter plugin" but   I failed when I tried it. Attached is the code i am working on which doesn't work. I kept just to let you all know what and how i am working .I expected the date header with nice small arrow for sorting but couldn't get it. I hope you guys would help me out.
<html>
	<head>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
		<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
		<script>
		  $(function() {
		   
		     $("#myTable").tablesorter();
		  });
		  $(document).ready(function() 
		    { 
			$("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); 
		    } 
		); 
</script>
</head>
  div id="main">
			SQL STATEMENTS....
				SET RS = objconn.execute(SQL)
				IF NOT RS.EOF THEN
					Response.Write "<table id= 'myTable' width='100%' cellpadding='0' cellspacing='0' border='1px'>"
						Response.Write "<tr>"
							Response.Write "<td  colspan='1'>"
								Response.Write "ID"
							Response.Write "</td>"
							Response.Write "<td  colspan='1'>"
								Response.Write "Date"
							Response.Write "</td>"
							Response.Write "<td  colspan='1'>"
								Response.Write "Title"
							Response.Write "</td>"
							Response.Write "<td  colspan='1'>"
								Response.Write "Author"
							Response.Write "</td>"
							Response.Write "<td colspan='1'>"
								Response.Write "Image Name"
							Response.Write "</td>"
						Response.Write "</tr>"
					While NOT RS.EOF
						Response.Write "<tr>"
							Response.Write "<td  colspan='1'>"
								Response.Write RS("id")
							Response.Write "</td>"
							Response.Write "<td  colspan='1'>"
								Response.Write RS("date")
							Response.Write "</td>"
							Response.Write "<td  colspan='1'>"
								Response.Write RS("title")
							Response.Write "</td>"
							Response.Write "<td class='tdcell' colspan='1'>"
								Response.Write RS("firstname") & " " & RS("lastname")
							Response.Write "</td>"
							Response.Write "<td class='tdcell' colspan='1'>"
								Response.Write RS("img")
							Response.Write "</td>"
						Response.Write "</tr>"
					RS.Movenext
					Wend
					Response.Write "</table>"
				END IF
				RS.Close
				Set RS = Nothing
			END IF
			%>
		</div>
	</body>
</html>
ASKER CERTIFIED SOLUTION
Robert Schutt
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros