📄 viewauctions.asp
字号:
<!-- #include file="adovbs.inc" -->
<!-- #include file="auctionlib.asp" -->
<%
iCatID = Request.Querystring("CatID")
'gsConnect = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("..\auction.MDB")
OpenDBConn
iPageSize = 10
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
Call DoPageHeader
Set GobjConnect = server.createobject("ADODB.Connection")
GobjConnect.open gsConnect
' Create recordset
Set objPagingRS = Server.CreateObject("ADODB.Recordset")
' Set cursor location and pagesize
objPagingRS.CursorLocation = adUseClient
objPagingRS.PageSize = iPageSize
gsSQL = ""
gsSQL = gsSQL & "SELECT * FROM Auctions WHERE CategoryID = " & SQLVal(iCatID) & " "
gsSQL = gsSQL & " AND AvailDate <= " & SQLDate(NOW)
gsSQL = gsSQL & " And Ended = false "
gsSQL = gsSQL & " ORDER BY CloseDate "
'Response.Write gsSQL
objPagingRS.Open gsSQL, GobjConnect, adOpenStatic, adLockReadOnly, adCmdText
tSQL = ""
tSQL = tSQL & "SELECT ID, CategoryName FROM Categories WHERE ID = " & SQLVal(iCatID)
Set Categoryrs = GobjConnect.Execute(tSQL)
iPageCount = objPagingRS.PageCount
If 1 > iPageCurrent Then iPageCurrent = 1
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
Response.Write("<FONT FACE =" & chr(34) & sFont & chr(34) & ">")
Response.Write("<P><CENTER><BIG><BIG>" & Categoryrs.Fields("CategoryName") & "</CENTER><P>")
Response.Write("<CENTER>")
Response.Write("<TABLE WIDTH=""600"" BORDER=""0"" CELLSPACING=""0"" CELLPADDING=""3"">")
Response.Write("<TR bgcolor=" & chr(34) & linecolor & chr(34) & "><TD COLSPAN=""4""> </TD></TR>")
Response.Write("<TR bgcolor=" & chr(34) & topcolor & chr(34) & ">")
Response.Write("<TD><SMALL><B>拍卖项目</B></SMALL></TD>")
Response.Write("<TD><SMALL><B>拍卖关闭时间</B></SMALL></TD>")
Response.Write("<TD><SMALL><B>目前投标数</B></SMALL></TD>")
Response.Write("<TD><SMALL><B>目前最高价</B></SMALL></TD>")
Response.Write("</TR>")
Response.Write("<TR bgcolor=" & chr(34) & linecolor & chr(34) & "><TD COLSPAN=""4""> </TD></TR>")
If objPagingRS.eof then
Response.Write("<TR bgcolor=""#FFFFFF""><TD COLSPAN=""4""><SMALL><CENTER>")
Response.Write("目前这个目录没有拍卖物")
Response.Write("</CENTER></SMALL></TD></TR>")
Else
' Move to the selected page
objPagingRS.AbsolutePage = iPageCurrent
iswitch = TRUE
Do While objPagingRS.AbsolutePage = iPageCurrent And Not objPagingRS.EOF
If iswitch = TRUE then
scolor = "#E9E9E9"
iswitch = False
Else scolor = "#FFFFFF"
iswitch = TRUE
End If
bidsSQL = ""
bidsSQL = bidsSQL & "SELECT COUNT(*) as Total FROM Bids Where ItemID = " & SQLVal(objPagingRS.Fields("ItemID"))
Set BidCountRS = GobjConnect.Execute(bidsSQL)
Response.Write("<TR>")
Response.Write("<TD><SMALL><A HREF=" & chr(34) & "viewitem.asp?ID=" & objPagingRS.Fields("ItemID") & chr(34) & ">" & objPagingRS.Fields("ItemTitle") & "</A>")
If Len(Trim(objPagingRS.Fields("ImageURL"))) > 0 Then
Response.Write("<IMG SRC=""images/pic.gif"">")
End If
If BidCountRS.Fields("Total") >= iHotItemCount Then
Response.Write("<IMG SRC=""images/hot.gif"">")
End If
Response.Write("</SMALL></TD>")
Response.Write("<TD><SMALL>" & objPagingRS.Fields("CloseDate") & "</SMALL></TD>")
Response.Write("<TD><SMALL>" & BidCountRS.Fields("Total") & "</SMALL></TD>")
Response.Write("<TD><SMALL>" & FormatCurrency(objPagingRS.Fields("CurrentBid"), 2) & "</SMALL></TD>")
Response.Write("</TR>")
BidCountRS.Close
Set BidCountRS = Nothing
objPagingRS.MoveNext
Loop
objPagingRS.close
Set objPagingRS = Nothing
End If
Response.Write("<TR bgcolor=" & chr(34) & linecolor & chr(34) & "><TD COLSPAN=""4""></TD></TR>")
Response.Write("<TR bgcolor=" & chr(34) & topcolor & chr(34) & "><TD COLSPAN=""4""><SMALL><CENTER>")
Call AuctionNavigation
Response.Write("</CENTER></SMALL></TD></TR>")
Response.Write("<TR bgcolor=" & chr(34) & linecolor & chr(34) & "><TD COLSPAN=""4""> </TD></TR></TABLE>")
Call PageNavigation
Call DoPageFooter
Call CloseDBConn
Sub PageNavigation
Response.Write("<CENTER><SMALL><SMALL>")
If iPageCurrent <> 1 AND iPageCurrent <> 0 Then
Response.Write ("<A HREF=""viewads.asp?scID=" & stID & chr(38) & "page=")
Response.Write iPageCurrent - 1
Response.Write """><SMALL>后退</SMALL></A>" & vbCrLf
' Spacer - inside the if so we don't get it unless needed
Else
Response.Write("<SMALL>后退</SMALL>")
End If
Response.Write " <small>页 <B>"
Response.Write iPageCurrent
Response.Write "</B> / <B>"
Response.Write iPageCount
Response.Write "</B></small> "
If iPageCurrent < iPageCount Then
Response.Write ("<A HREF=""viewads.asp?scID=" & stID & chr(38) & "page=")
Response.Write iPageCurrent + 1
Response.Write """><SMALL>前进</SMALL></A>" & vbCrLf
Else
Response.Write("<SMALL>前进</SMALL>")
End If
Response.Write("</SMALL></SMALL></CENTER>")
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -