amoos
asked on
How to alphabitize documents produced by asp script??
i have a asp script that produces documents uploaded to a server directory and then displayed in a page. how do i alphabitize these results?? code is below
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
Dim strFileSize
Set MyDirectory=Server.CreateO bject("Scr ipting.Fil eSystemObj ect")
Set MyFiles=MyDirectory.GetFol der(Server .MapPath(" /misc/"))
For each filefound in MyFiles.files
If filefound.Name <> "default.asp" then
%>
<a href="/misc/<%= filefound.Name %>"><%= filefound.Name %></a><br />
<%
End if
Next
%>
</body>
</html>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
Dim strFileSize
Set MyDirectory=Server.CreateO
Set MyFiles=MyDirectory.GetFol
For each filefound in MyFiles.files
If filefound.Name <> "default.asp" then
%>
<a href="/misc/<%= filefound.Name %>"><%= filefound.Name %></a><br />
<%
End if
Next
%>
</body>
</html>
ASKER
great thank you. i ran it and below is the error i get
ADODB.Fields error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/misc/default.asp, line 17
ADODB.Fields error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/misc/default.asp, line 17
ASKER
also i did notice in the script that the below line was in there. what am i suppose to change it to?? awesome help
objRSFiles.Sort = "FileName ASC" ' Change this
objRSFiles.Sort = "FileName ASC" ' Change this
For the error change line 17 to
objRSFiles.Fields.Append "FileName", 200, 255
The comment in the other line should've been removed. To save time I copied from some previous questions I helped in. I didn't remove that comment.
Let me know how it works with this correction or if you have any other questions.
bol
objRSFiles.Fields.Append "FileName", 200, 255
The comment in the other line should've been removed. To save time I copied from some previous questions I helped in. I didn't remove that comment.
Let me know how it works with this correction or if you have any other questions.
bol
ASKER
awesome, thank you. ok it ran and showed the documents but below is an error that was displayed.
Microsoft VBScript runtime error '800a005b'
Object variable not set
/misc/default.asp, line 38
Microsoft VBScript runtime error '800a005b'
Object variable not set
/misc/default.asp, line 38
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually I realize I may have typoed each line. Change lines 38 & 39 to ...
Set objRSFiles = Nothing
Set MyDirectory = Nothing
See if that works better first. That is the proper syntax.
bol
Set objRSFiles = Nothing
Set MyDirectory = Nothing
See if that works better first. That is the proper syntax.
bol
ASKER
brilliant. truely awesome work. i removed both lines and bingo it worked with no errors. thank you so much for all your help
ASKER
awesome help thank you
Your welcome! I'm glad I could help. Thanks for another fun question. :)
bol
bol
bol
Open in new window