We help IT Professionals succeed at work.

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

Bade011
Bade011 asked
on
426 Views
Last Modified: 2015-09-28
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>

Open in new window

Comment
Watch Question

Software Engineer
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.