Asp fejl
HejJeg får en fejl når jeg køre denne her:
%>
<!-- #INCLUDE FILE="common.asp" -->
<%
ShowHead
OpenDataConn
Function GetNMonthsAgo(iMonthsAgo)
Dim dPastDate
dPastDate = DateAdd("m", -iMonthsAgo, Now())
GetNMonthsAgo = CDate(Month(dPastDate) & "/1/" & Year(dPastDate))
End Function
%>
<%
Dim objForumRS, objMessageRS
Dim objForumCountRS, objMessageCountRS
Dim strThreadList
Dim iActiveForumId, iActiveForumName
Dim iForumMessageCount
Dim iMonthsToGoBack, iMonthLooper
Dim iMonthsAgo
iActiveForumId = Request.QueryString("fid")
If IsNumeric(iActiveForumId) Then
iActiveForumId = CInt(iActiveForumId)
Else
iActiveForumId = 0
End If
iMonthsAgo = Request.QueryString("ma")
If IsNumeric(iMonthsAgo) Then
iMonthsAgo = CInt(iMonthsAgo)
Else
iMonthsAgo = 0
End If
' Get Forum Info and count of messages in the forum
Set objForumRS = GetRecordset("forums")
Set objForumCountRS = GetRecordset("SELECT forum_id, COUNT(*) FROM messages GROUP BY forum_id;")
If Not objForumRS.EOF Then
objForumRS.MoveFirst
Do While Not objForumRS.EOF
'Position Forum Count RS and get a message count
objForumCountRS.MoveFirst
Do Until objForumCountRS.EOF
If objForumCountRS.Fields("forum_id") = objForumRS.Fields("forum_id") Then Exit Do
objForumCountRS.MoveNext
Loop
If Not objForumCountRS.EOF Then
iForumMessageCount = objForumCountRS.Fields(1)
Else
iForumMessageCount = 0
End If
' If active forum -> show messages o/w -> just show forum
If objForumRS.Fields("forum_id") = iActiveForumId Then
ShowForumLine objForumRS.Fields("forum_id"), "open", objForumRS.Fields("forum_name"), objForumRS.Fields("forum_description"), iForumMessageCount
' Show links to previous months
iMonthsToGoBack = DateDiff("m", objForumRS("forum_start_date"), Now())
For iMonthLooper = 0 To iMonthsToGoBack
'Do month message count here.
'Set objMessageCountRS = GetRecordset("SELECT COUNT(*) FROM messages WHERE DESC;")
ShowMonthLine objForumRS.Fields("forum_id"), iMonthLooper, 0
'objMessageCountRS.Close
'Set objMessageCountRS = Nothing
If iMonthLooper = iMonthsAgo Then
'Show Root Level Posts for the selected month and their reply count
Select Case DB_TYPE
Case "Access"
Set objMessageRS = GetRecordset("SELECT * FROM messages WHERE forum_id=" & iActiveForumId & " AND thread_parent=0 AND #" & GetNMonthsAgo(iMonthsAgo) & "# < message_timestamp AND message_timestamp < #" & GetNMonthsAgo(iMonthsAgo - 1) & "# ORDER BY thread_id DESC;")
Case "SQL"
Set objMessageRS = GetRecordset("SELECT * FROM messages WHERE forum_id=" & iActiveForumId & " AND thread_parent=0 AND '" & GetNMonthsAgo(iMonthsAgo) & "' < message_timestamp AND message_timestamp < '" & GetNMonthsAgo(iMonthsAgo - 1) & "' ORDER BY thread_id DESC;")
End Select
' Build the list we need counts for
If Not (objMessageRS.BOF And objMessageRS.EOF) Then
objMessageRS.MoveFirst
Do While Not objMessageRS.EOF
strThreadList = strThreadList & objMessageRS("thread_id") & ","
objMessageRS.MoveNext
Loop
strThreadList = Left(strThreadList, Len(strThreadList) - 1)
Else
strThreadList = (0)
End If
Set objMessageCountRS = GetRecordset("SELECT thread_id, COUNT(*) FROM messages WHERE thread_id IN (" & strThreadList & ") GROUP BY thread_id ORDER BY thread_id DESC;")
' We don't worry about a zero count because every thread should have at least 1 message
' Along the same lines, objMessageRS.RecordCount needs to equal objMessageCountRS.RecordCount
' We assume they do. If not we're in deep sh*t! Please never break! I'm, begging here!
'Response.Write objMessageRS.RecordCount & "<BR>" & vbCrLf
'Response.Write objMessageCountRS.RecordCount & "<BR>" & vbCrLf
' Oh what the heck, even if it does break it's only the message count and not checking each record gives us a HUGE SPEED BOOST...
' Screw it, here goes...
If Not (objMessageRS.BOF And objMessageRS.EOF) Then
objMessageRS.MoveFirst
objMessageCountRS.MoveFirst
Do While Not objMessageRS.EOF
ShowMessageLine 1, objMessageRS.Fields("message_id"), objMessageRS.Fields("message_subject"), objMessageRS.Fields("message_author"), objMessageRS.Fields("message_author_email"), objMessageRS.Fields("message_timestamp"), objMessageCountRS.Fields(1) - 1, "forum"
objMessageRS.MoveNext
objMessageCountRS.MoveNext
Loop
End If
'Close Message DB objects
objMessageCountRS.Close
Set objMessageCountRS = Nothing
objMessageRS.Close
Set objMessageRS = Nothing
End If
Next 'I
'Set active Forum Name for later use in post line
iActiveForumName = objForumRS.Fields("forum_name")
Else
ShowForumLine objForumRS.Fields("forum_id"), "closed", objForumRS.Fields("forum_name"), objForumRS.Fields("forum_description"), iForumMessageCount
End If
objForumRS.MoveNext
Loop
Else
WriteLine "There are no folders currently open." & "<BR>"
End If
'Close Forum DB objects
objForumCountRS.Close
Set objForumCountRS = Nothing
objForumRS.Close
Set objForumRS = Nothing
If iActiveForumId <> 0 Then
%>
<html>
<head>
<title></title>
<style>
<!--
-->
</style>
</head>
<body>
<p><br>
<a HREF="post_message.asp?fid=<%= iActiveForumId %>"><font SIZE="-1" COLOR="#0000FF"><i>Post
a New Message to <b><%= iActiveForumName %></b></i></font></a><br>
<%
End If
WriteLine "<BR><BR>"
WriteLine "<FONT SIZE=""-1""><B>Search the forums for a keyword:</B></FONT>"
ShowSearchForm
%><%
CloseDataConn
ShowTail
%></p>
</body>
</html>
Fejl koden:
An error occurred on the server while processing the script/page you requested. Please try reloading the page in a few minutes. If the problem persists, please contact the system administrator.
/Wall
