% Option Explicit dim strSection, strSectFile, strConn, strLine, strUseHead, strFullSection, strORDER dim SQL, SQLsuffix, whichFile, bookHeaderFile, intCount, intCurrent, intTmp dim fs, conn, bd, bdCOUNT dim db ' ======= Initialize variables ====================== intCount = 0 intCurrent = 0 strORDER = "new DESC, sort ASC" ' ======= End Initialize variables ================== ' ======= Gather and parse input from URL =========== strSection = Request("section") ' Set Needed Variables from URL Set fs = CreateObject("Scripting.FileSystemObject") strSectFile = strSection & ".html" ' Check file If not fs.fileExists(Server.MapPath(strSectFile)) Then strSectFile = "error.html" strSection = "error" End If intCount = CInt(Request("start")) strUseHead = Request("usehead") ' ======= End Gather and parse input from URL =========== ' ======= Open connection to bookstore database ======= Session.timeout = 15 ' ======= Comment by Kasapa Aware Co,Ltd ======= 'strConn = "bookstoreDB" 'Set conn = Server.CreateObject("ADODB.Connection") 'conn.Open strConn ' ======= Add by Kasapa Aware Co,Ltd ======= db ="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("../database/booklist.mdb") Select Case strSection case "new" SQLsuffix = " WHERE new = 'yes'" case "all" SQLsuffix = "" case else SQLsuffix = " WHERE section = '" & strSection & "'" end Select if strSection = "new" Or strSection = "all" then strORDER = "sort ASC" end if ' ======= Comment by Kasapa Aware Co,Ltd ======= ' CREATE RECORDSOURCE set to 'bd' 'SQL = "SELECT * FROM books" & SQLsuffix & " ORDER BY " & strORDER 'Set bd = conn.Execute(SQL) ' ======= Add by Kasapa Aware Co,Ltd ======= SQL = "SELECT * FROM books" & SQLsuffix & " ORDER BY " & strORDER Set bd = Server.CreateObject("ADODB.Recordset") bd.Open SQL, db,1,3 ' ======= Comment by Kasapa Aware Co,Ltd ======= ' CREATE RECORDSOURCE FOR COUNT set to 'bdCOUNT' as 'total' 'SQL = "SELECT COUNT(*) AS [total] FROM books" & SQLsuffix 'Set bdCOUNT = conn.Execute(SQL) ' ======= Add by Kasapa Aware Co,Ltd ======= SQL = "SELECT COUNT(*) AS [total] FROM books" & SQLsuffix Set bdCOUNT = Server.CreateObject("ADODB.Recordset") bdCOUNT.Open SQL, db,1,3 ' ======= End open connection to bookstore database ======= ' ======= Open header file ======== whichFile = Server.MapPath(strSectFile) Set bookHeaderFile = fs.OpenTextFile(whichfile, 1, False) strFullSection = bookHeaderFile.readline ' ======= End Open header file ======== %>
Our 4 largest sections of books:
The most interesting and inspiring
New Books
African Art and |
More <%=getFullTitle(strSection)%> Books:
<% dim intTotal, intNum intCurrent = 0 intNum = 0 intTotal = CInt(bdCOUNT("total")) if intCount > 10 then response.write("<<Prev " & vbNewline) end if do until intCurrent >= intTotal intNum = intNum + 1 if intCurrent = CInt(Request("start")) then response.write(" " & intNum & " ") else response.write(" " & intNum & " " & vbNewline) end if intCurrent = intCurrent + 10 loop if intCount > intTotal then response.write(" ") else response.write(" Next>> ") end if %>
|