Share
Server.ScriptTimeout = 3000 Const ForReading = 1,defaultstring= -2 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 'Create an ADO connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection strCon="Provider=SQLOLEDB; Data Source=SQLA22.webcontrolcenter.com; Initial Catalog=messageboard; User ID=ernestpr1; Password=boomer;network=dbmssocn " 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 topic_id, Subject,pageno from tblTopic,ads where ads.pageno=tblTopic.topic_id and topic_id32954 order by topic_id" 'Open the recordset with the SQL query rsGuestbook.Open strSQL, adoCon Do While NOT rsGuestbook.EOF response.write topic_id & "
" ' Loop through all the records bset = rsGuestbook("topic_id") + 1 'create file set f=fs.CreateTextFile("d:inetpubadhdnews estforum est" & rsGuestbook("topic_id") & ".htm",true) strtotal= "" 'Initialize the strSQL variable for the threads strSQL2 = "SELECT message from tblThread where topic_id = " & rsGuestbook("topic_id") 'Open the recordset with the SQL query rsThreads.Open strSQL2, adoCon Do While NOT rsThreads.EOF 'Loop through all the matching threads strtotal = strtotal & rsThreads("message") rsThreads.MoveNext Loop rsThreads.close 'strtotal is the complete message thread 'subject is the message subject 'topic_id is the 'code start dim fs1,filestuff,str1, objtextstream str1="d:inetpubadhdnews estforum emplate2.htm" set fs1=Server.CreateObject("Scripting.FileSystemObject") set objgotit= fs1.GetFile(str1) set objtextstream= objgotit.OpenAsTextStream(ForReading,defautstring) do while objtextstream.AtEndOfStream True strline= objtextstream.readline strlength= len(strline) stringtofind="" instring = Instr(strline,stringtofind) stringlength=len(stringtofind) strlineout = strline & vbCrLf If instring > 0 Then stringout = mid(strline,1,instring-1) stringright= mid(strline,instring+stringlength,strlength-instring-stringlength+1) strlineout= stringout & " ADHD Information -" & rsGuestbook("Subject") & stringright & vbCrLf End If stringtofind="findstring1" instring = Instr(strline,stringtofind) stringlength=len(stringtofind) If instring > 0 Then stringout = mid(strline,1,instring-1) stringright= mid(strline,instring+stringlength,strlength-instring-stringlength+1) strlineout= stringout & rsGuestbook("Subject") & stringright & vbCrLf End If stringtofind="findstring2" instring = Instr(strline,stringtofind) stringlength=len(stringtofind) If instring > 0 Then stringout = mid(strline,1,instring-1) stringright= mid(strline,instring+stringlength,strlength-instring-stringlength+1) strlineout = stringout & "Back to ADHD Information >" & rsGuestbook("Subject") & " " & ">" & " " & "Next Topic" & stringright & vbCrLf End If stringtofind="findstring3" instring = Instr(strline,stringtofind) stringlength=len(stringtofind) If instring > 0 Then stringout = mid(strline,1,instring-1) stringright= mid(strline,instring+stringlength,strlength-instring-stringlength+1) strlineout = stringout & strtotal & stringright & vbCrLf End If 'ok see if database has this there If len(strtotal) > 500 Then f.write(strlineout) Else End If loop f.close objTextStream.Close 'code end rsGuestbook.MoveNext Loop rsGuestbook.close