I want to retrieve the data from a database and put it in a table but I need to use a nested loop. I think my code is close and I know I've done it before but I can't that code any where.
I want it to look like this:
Folder 1
File 1
File 4
Folder 2
File 3
File 7
Folder 3
File 5
I have a Folder table and File table and I want it to get the FolderID from the Folder table and then get the FolderID's in the Files table that match.
This is what I have so far:
I get an error message on the line that has the Select statement that has the "sFolderID" in it. I know I need to retrieve that from the first recordset but I'm not sure how to do that within the loop.
Thanks.
I want it to look like this:
Folder 1
File 1
File 4
Folder 2
File 3
File 7
Folder 3
File 5
I have a Folder table and File table and I want it to get the FolderID from the Folder table and then get the FolderID's in the Files table that match.
This is what I have so far:
Code:
Set rsFolders = objConn.execute("SELECT FolderID, FolderName FROM Folders GROUP BY FolderID, FolderName")
Set rsFiles = objConn.execute("SELECT * FROM FileInfo WHERE FolderID=" & sFolderID & " ORDER BY FileName")
<% While not rsFolders.EOF %>
<%=rsFolders("FolderName")%><br>
<% While not rsFiles.EOF %>
<%=rsFiles("Filename")%><br>
<% rsFiles.MoveNext
Wend
%>
<% rsFolders.MoveNext
Wend
%>
I get an error message on the line that has the Select statement that has the "sFolderID" in it. I know I need to retrieve that from the first recordset but I'm not sure how to do that within the loop.
Thanks.