<%
dim pgCat
pgCat="sams55"
%>
<%
'Photo Catalog Application by Ning Zhou
'Use and Customize Freely as You Wish
'Please Link to www.ningzhou.com
'Enjoy!
%>
<%
dim intCurrentPageNum, strSortBy, strCategory, count, strSearchText, intDaysOld
'intCurrentPageNum=Int(request.querystring("Page"))
'if intCurrentPageNum < 1 then
intCurrentPageNum = 1
'end if
'strSortBy=request.querystring("SortBy")
'if strSortBy = "" then
strSortBy = "fileName"
'end if
'strCategory=request.querystring("Cat")
'if strCategory = "" then
' strCategory = "All"
'end if
strCategory=pgCat
strCategory = Replace(strCategory, "%20", " ")
strCategory = Replace(strCategory, "+", " ")
'strSearchText=request.querystring("searchText")
'if strSearchText = "" then
strSearchText = ""
'end if
'intDaysOld=request.querystring("daysOld")
'if IsNumeric(intDaysOld) then
' if Int(intDaysOld) <1 then
intDaysOld = -1
' end if
'else
' intDaysOld = -1
'end if
dim conn
dim rs
dim strID
dim strconn, strSQL
'set a local variable to my DSN-less connection String
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(dbPath)
'Create the Connection object
set conn = server.createobject("adodb.connection")
conn.open strconn
strSQL = "select * from photographs"
dim condition
condition=false
if strCategory <> "All" and strCategory <> "" then
strSQL = strSQL + " where Category = '" & strCategory & "'"
condition = true
end if
if strSearchText <>"" then
if condition then
strSQL = strSQL & " and Name like '%" & strSearchText & "%'"
else
strSQL = strSQL & " where Name like '%" & strSearchText & "%'"
condition = true
end if
end if
if intDaysOld > 0 then
if condition then
strSQL = strSQL & " and DATEDIFF('d', CDate(DateModified), now()) <" & intDaysOld
else
strSQL = strSQL & " where DATEDIFF('d', CDate(DateModified), now()) <" & intDaysOld
condition = true
end if
end if
strSQL = strSQL & " order by " & strSortBy
if UCase(strSortBy) <> "FILENAME" then
strSQL = strSQL + ", fileName"
end if
'Create the recordset object
set rs = server.createobject("adodb.recordset")
rs.CursorType = 3
rs.open strSQL, conn
If not rs.EOF Then
rs.PageSize=intColPerPage * 40 'intRowPerPage
rs.AbsolutePage=intCurrentPageNum
count = 1
%>
| Photo Gallery |
.: <%=rs.RecordCount%> Photos
|
|
|
|
|
|
|