<%@Language="VBScript"%> <%Response.Buffer = True%> <% Server.ScriptTimeOut = 600 On Error Resume Next Dim strRootFolder Dim intLenRootFolder Dim objFSO Dim strXmlFile Dim strVbCrLf Dim strVbTab Dim numTree Dim objFile strVbCrLf = VbCrLf strVbTab = VbTab numTree = 0 strRootFolder = (Server.MapPath("photos\")) intLenRootFolder = Len(strRootFolder) strXmlFile = "" & strVbCrLf '-- create an instance of the FSO object Set objFSO = Server.CreateObject("Scripting.FileSystemObject") '-- open file for writing, create if not there, and open as text Set objFile = objFSO.CreateTextFile(strRootFolder & "menuitems.xml", True, False) '-- write root node objFile.Write(strXmlFile) Call TraverseSite(strRootFolder,numTree) Sub TraverseSite(strFolder,thisTree) '-- reset the string which gets written to the XML file strXmlFile = "" '-- declare our variables in the sub Dim objFolder, objSubFolder, objSubFile, i Dim objThisFolder, objthisFile, strURL, strFolderURL '-- grab the folder passed in the sub Set objFolder = objFSO.GetFolder(strFolder) '-- grab its subfolders 'Set objSubFolder = objFolder.SubFolders '-- grab its files Set objSubFile = objFolder.Files '-- properly nest the nodes for a nice display For i = 1 To thisTree strXmlFile = strXmlFile & strVbTab Next '-- get the folder path excluding the application root folder 'strFolderURL = Mid(objFolder.Path, intLenRootFolder, Len(objFolder.Path)) '-- turn the physical path into a relative path strFolderURL = Replace(strFolderURL, "\", "/") '-- append node to the output unless it is the root folder If thisTree > 0 Then strXmlFile = strXmlFile & "" & strVbCrLf objFile.Write(strXmlFile) End If '-- reset the string output again strXmlFile = "" '-- if there are subfolders under it then run sub again for each one 'If Not IsEmpty(objSubFolder) Then ' For Each objThisFolder in objSubFolder ' Call TraverseSite(objThisFolder.Path,thisTree + 1) ' Next ' End If '-- if there are files in the folder If Not IsEmpty(objSubFile) Then For Each objthisFile in objSubFile '-- properly nest the nodes for a nice display For i = 0 To thisTree + 1 strXmlFile = strXmlFile & strVbTab Next '-- get the virtual path strURL = Mid(objthisFile.Path, intLenRootFolder, Len(objthisFile.Path)) strURL = Replace(strURL, "\", "/") '-- create output string strXmlFile = strXmlFile & "" & strVbCrLf Next '-- write output to XML file objFile.Write(strXmlFile) strXmlFile = "" End If For i = 1 To thisTree strXmlFile = strXmlFile & strVbTab Next '-- close the folder node If thisTree > 0 Then strXmlFile = strXmlFile & "" & strVbCrLf End If objFile.Write(strXmlFile) strXmlFile = "" '-- show the progress of the code as it goes through folders ' Response.Write("Folder " _ ' & strFolderURL & " written!
") Response.Flush End Sub '--write end root node objFile.Write("
") objFile.close Set objFile = Nothing Set objFSO = Nothing %> GIGNETWORK
  <% '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 'Create an ADO connection odject Set adoCon = Server.CreateObject("ADODB.Connection") 'Set an active connection to the Connection object using a DSN-less connection adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb") 'Set an active connection to the Connection object using DSN connection 'adoCon.Open "DSN=guestbook" 'Create an ADO recordset object Set rsGuestbook = Server.CreateObject("ADODB.Recordset") 'Initialise the strSQL variable with an SQL statement to query the database '**************************************change this to match page clicked!!!!! 'strSQL = "SELECT * FROM tblComments WHERE name" _ & "= #" & variablehere & "#;" strSQL = "SELECT * FROM tblComments WHERE name ='samples';" 'Open the recordset with the SQL query rsGuestbook.Open strSQL, adoCon 'Loop through the recordset Response.Write ("
") Do While not rsGuestbook.EOF Response.Write ("
") Response.Write (rsGuestbook("Comments")) Response.Write ("
") 'Move to the next record in the recordset rsGuestbook.MoveNext Loop 'Reset server objects rsGuestbook.Close Set rsGuestbook = Nothing Set adoCon = Nothing %>
 
     
     
  © Simmo Publications LTD |  Login  
     
Order issues