%@ Language=VBScript %>
Skyline Business School - Discussion Board
<%
dim user
user=Session("loggedUser")
Application.Lock
%>
<%
dim rsoTemp,strSQL,rsoTemp1, strSQL1, rsoTemp2
set rsoTemp=Server.CreateObject("ADODB.Recordset")
set rsoTemp1=Server.CreateObject("ADODB.Recordset")
set rsoTemp2=Server.CreateObject("ADODB.Recordset")
%>
 |
<%
dim nameChnl,chnlID,rcCount,strSQL2
dim tpcId,nameTpc
strSQL="select * from tblDiscussion order by channelName"
rsoTemp.Open strSQL,myConn,3
strSQL1="select * from tblTopics"
rsoTemp1.Open strSQL1,myConn,3
strSQL2="select * from tblMessages"
rsoTemp2.Open strSQL2,myConn,3
' getting all the records from the database.
dim ctr
ctr=0
'do while not rsoTemp.EOF
for ctr=1 to rsoTemp.RecordCount
'ctr=ctr+1
chnlID=rsoTemp.Fields("channelID")
nameChnl=rsoTemp.Fields("channelName")
rsoTemp1.Filter="channelID="& chnlID
' counting the total number of records available in the tblTopics associated with the Channel ID.
rcCount=rsoTemp1.RecordCount
%>
- <%=nameChnl%> (<%=rcCount%>)
<%
if not rcCount=0 then
' iterating thru the records & checking for the Topics whose ChannelId's are equal.
do while not rsoTemp1.EOF
tpcId=rsoTemp1.Fields("topicID")
nameTpc=rsoTemp1.Fields("Topic")
rsoTemp2.Filter="channelID=" & chnlID & " and topicID=" & tpcID
%>
<%=nameTpc%> (<%=rsoTemp2.RecordCount%>)
<%
' move to the Next Record
rsoTemp1.MoveNext
loop
end if
'rsoTemp1.Close 'close the Recordset before opening it again.
rsoTemp.MoveNext 'move to the Next Record.
Next
%>
<%
' end if
' end if
Application.UnLock
%>