Avatar of Bade011
Bade011
 asked on

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

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

ASPHTMLJSONJavaScript

Avatar of undefined
Last Comment
Robert Schutt

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robert Schutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61