<%
Server.ScriptTimeout = 2000
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Dim strtotal, strSQL2
Dim cr ' Carraige return
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open strCon
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
Set rsThreads = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strsql="select tbltopic.topic_id,message,subject from tbltopic, tblthread where tblthread.topic_id=tbltopic.topic_id and tbltopic.topic_id<25000 order by tbltopic.topic_id;"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
ct=0
message_string=""
Do While NOT rsGuestbook.EOF
message_string=message_string & rsGuestbook("message")
topic_id=rsGuestbook("topic_id")
subject=rsGuestbook("subject")
rsGuestbook.MoveNext
if topic_id<>rsGuestbook("topic_id") Then
t=writepage(subject, topic_id, message_string)
If len(t) > 500 Then
set f=fs.CreateTextFile("d:\inetpub\arthritisinsight\archives\test" & topic_id & ".htm",true)
f.write(t)
Else
End If
message_string="" ' reset message string to null will pick up value in next iteration
topic_id=rsGuestbook("topic_id") ' set topic id
End IF
Loop
%>