Print Page | Close Window

Order data in a table

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=3691
Printed Date: 29 March 2026 at 10:57pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Order data in a table
Posted By: Boecky
Subject: Order data in a table
Date Posted: 20 June 2003 at 6:37am

Hi, I want to make a table with some links in it to order on name, addres, telephone,... I already make something that "works", but I want to replace the If ... Then statement to a Select Case. Can someone help me?


<mailto:%@LANGUAGE="VBscript'>%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="include/Connection.inc" -->
<%
Dim Conn
Dim rsTest

Set Conn = Server.CreateObject("ADODB.Connection")
ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\test\testdb.mdb"
Conn.Open ConnStr

Set rsTest = Server.CreateObject("ADODB.Recordset")
rsTest.ActiveConnection = Conn

Dim strCase
strCase = Request.QueryString("sort")
If strCase = "naam" Then
  rsTest.Source = "Select * FROM tblKlant ORDER BY Naam ASC;"
Else
  rsTest.Source = "Select * FROM tblKlant ORDER BY Telefoon DESC;"
End If
rsTest.Open
%>




Replies:
Posted By: MorningZ
Date Posted: 20 June 2003 at 8:43am
Dim strCase
strCase = Request.QueryString("sort")
If strCase = "" Then
  rsTest.Source = "Select * FROM tblKlant ORDER BY " & strCase
Else
  rsTest.Source = "Select * FROM tblKlant"
End If


-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Boecky
Date Posted: 20 June 2003 at 9:24am
Works great, thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net