madanthrax
IS-IT--Management
Hi,
I have a view created from two tables, one with uploaded file data (url, link text, date etc) and one with the folders info. The view gives me the folder name attached to every row of file data.
I need to place records in about 9 places on an asp page. They need to have the folder title first then a list of the contained uploaded files underneath. I could make 18 recordsets filtering using 'where' statement and plop them on the page easily.
However above is messy so I want to try and use a single recordset:
And the plan is to use Wend statements similar to this below for the titles with something like an if then statement in it:
I have tried using <% if rsInsagFiles("ID") = 199 then %> (199 is the folder ID) but this gives me multiple instances of the folder title (from each file record).
When I attempt to stop the loop when the first 199 record is found I always get an error. I have tried using UNTIL but I am not sure what I am doing..... The code below does not work but maybe someone can see what I am trying to do:
Any help would be greatly appreciated.
Anthony
I have a view created from two tables, one with uploaded file data (url, link text, date etc) and one with the folders info. The view gives me the folder name attached to every row of file data.
I need to place records in about 9 places on an asp page. They need to have the folder title first then a list of the contained uploaded files underneath. I could make 18 recordsets filtering using 'where' statement and plop them on the page easily.
However above is messy so I want to try and use a single recordset:
Code:
<%
Dim rsInsagFiles
Dim rsInsagFiles_cmd
Dim rsInsagFiles_numRows
Set rsInsagFiles_cmd = Server.CreateObject ("ADODB.Command")
rsInsagFiles_cmd.ActiveConnection = MM_NSweb_STRING
rsInsagFiles_cmd.CommandText = "SELECT * FROM dbo.vw_InsagPublic"
rsInsagFiles_cmd.Prepared = true
Set rsInsagFiles = rsInsagFiles_cmd.Execute
rsInsagFiles_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsInsagFiles_numRows = rsInsagFiles_numRows + Repeat1__numRows
%>
And the plan is to use Wend statements similar to this below for the titles with something like an if then statement in it:
Code:
<%
While ((Repeat1__numRows <> 0) AND (NOT rsInsagFiles.EOF))
%>
<h3><%=(rsInsagFiles("FolderName"))%></h3>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsInsagFiles.MoveNext()
Wend
%>
I have tried using <% if rsInsagFiles("ID") = 199 then %> (199 is the folder ID) but this gives me multiple instances of the folder title (from each file record).
When I attempt to stop the loop when the first 199 record is found I always get an error. I have tried using UNTIL but I am not sure what I am doing..... The code below does not work but maybe someone can see what I am trying to do:
Code:
<%
While ((Repeat1__numRows <> 0) AND (NOT rsInsagFiles.EOF))
%>
<% if rsInsagFiles("ID") = 199 then %>
<h3><%=(rsInsagFiles("FolderName"))%></h3>
<%
else
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsInsagFiles.MoveNext()
Wend
end if
%>
Anthony
[sub]"Nothing is impossible until proven otherwise"[/sub]