<%
Dim cnnSimple ’ ADO connection
Dim rstSimple
Dim strDBPath
Dim Count
strDBPath = Server.MapPath(“MYDATABASE.mdb”)
Set cnnSimple = Server.CreateObject(“ADODB.Connection”)
cnnSimple.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & strDBPath & “;”
%>
<%
Dim rs
Set rs = Server.CreateObject(“ADODB.RecordSet”)
%>
<%
Set rstSimple = cnnSimple.Execute(“SELECT * FROM deals WHERE List=True ORDER BY ID DESC”)
Set rstCoupon = cnnSimple.Execute(“SELECT CouponTBL.SiteName, CouponTBL.Description, CouponTBL.ID, CouponTBL.CouponCode, CouponTBL.Expires FROM CouponTBL WHERE List=True ORDER BY ID DESC”)
%>
<html>
<head>
</head>
<body bgcolor=“#78A4B8” marginwidth=“0” marginheight=“0” leftmargin=“0” topmargin=“0”>
<table border=“0” cellpadding=“0” cellspacing=“0” width=“770”>
<tr>
<td width=“600” valign=“top”>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/blk.gif" width="594" height="1"></td>
</tr>
<tr>
<td><img scr="images/s.gif" width="1" height="7"></td>
</tr>
<tr>
<td align="center"><img src="images/dealsterlogo.gif" width="215" height="78"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <%
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1
Dim qString
%>
<%
Dim mypage, numpages, numrecs, pagesize
mypage = CInt( Request(“page”) )
If mypage=0 Then mypage=1
pagesize = CInt( Request(“recs”) )
If pagesize = 0 Then pagesize = 10 ’ If we aren’t given a value use 10
'Set rs = Server.CreateObject(“ADODB.RecordSet”)
rs.PageSize = pagesize
rs.CacheSize = pagesize
rs.CursorLocation = adUseClient
qString = “SELECT * FROM deals WHERE Archive=True ORDER BY ID DESC”
rs.Open qString, cnnSimple, adOpenForwardOnly, adLockReadOnly, adCmdText
numpages = rs.PageCount
numrecs = rs.RecordCount
If mypage > numpages Then mypage = numpages
If mypage < 1 Then mypage = 1
rs.AbsolutePage = mypage
Response.Write(“<P> <B>” & numrecs & " records found.</B>" )
Response.Write("<BR> Page " & mypage & " of " & numpages & “</P>”)
Response.Write(“<CENTER>”)
Dim i
For i=1 To pagesize
If NOT rs.EOF Then
Response.Write(rs(“headline”) & " | " & rs(“store”) & " <BR>")
rs.MoveNext
End If
Next
Response.Write(“<P>”)
Dim x, lb, ub
For x=1 To numpages
lb = (x-1) * pagesize + 1
ub = x * pagesize
If ub > numrecs Then ub = numrecs
If x <> mypage Then
Response.Write(“<A HREF=archivester.asp?page=” & x & “&recs=” & pagesize & “>” & lb & “-” & ub & “</A>”)
Else
Response.Write(lb & “-” & ub)
End If
If x <> numpages Then Response.Write(" | ")
Next
Response.Write(“</CENTER>”)
rs.Close
cnnSimple.Close
Set rs = Nothing
Set cnnSimple = Nothing
%>
<p> </p>
<form name="myform" method="post" action="archivester.asp">
Show <select name="recs" onchange="updateBoxes(myform)">
<option value="5">5
<option value="10">10
<option value="25">25
<option value="50">50
<option value="100">100
</select> records per page<br>
Display page <select name="page">
<option>
<option>
<option>
<option>
<option>
<option>
<option>
<option>
</select><br>
<input type="submit" value="GO!">
</form>
<SCRIPT LANGUAGE=“JavaScript”>
NUM_RECORDS = <%=numrecs%>;
function updateBoxes(theFormObj)
{
var selectedRecs = theFormObj.recs.options[theFormObj.recs.selectedIndex].value;
var numpages = Math.ceil(NUM_RECORDS / selectedRecs);
var numOptions = theFormObj.page.length;
for(var i=0 ; i<numOptions ; i++) {
theFormObj.page.options[0] = null;
}
for(var j=0 ; j<numpages ; j++) {
theFormObj.page.options[j] = new Option(j+1,j+1);
}
theFormObj.page.selectedIndex = 0;
}
</SCRIPT>
<SCRIPT>
updateBoxes(document.myform);
</SCRIPT>
</td>
<!--Second Column-->
<!--Recent Coupons-->
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/s.gif" width="20" height="1" alt></td>
<td background="images/l.gif" width="20"><img src="images/s.gif" width="20" height="1" alt="0"></td>
<td background="images/b.gif"><font size="2" face="Arial, Helvetica, Sans-Serif" color="#ffffff"><b>Recent
Coupons</b></font></td>
<td background="images/r.gif" width="20"><img src="images/s.gif" width="20" height="1" alt="0"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="98.5%" bgcolor="#000000" align="center">
<tr>
<td>
<table border="0" cellpadding="3" cellspacing="1" width="100%">
<tr>
<td bgcolor="#ffffff">
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td>
<%
Dim i
i = 0
%>
<%
Do While i<=30
%>
<em><%= rstCoupon.Fields("SiteName").Value %></em><br>
<span class="det"><%= rstCoupon.Fields("Description").Value %><br>
Exp: <%= rstCoupon.Fields("Expires").Value %><br>
Use Code: <a href="jumpcpn.asp?ID=<%= rstCoupon.Fields("ID").Value %>"><%= rstCoupon.Fields("CouponCode").Value %></a></span>
<hr size="1" color="blue">
<%
i=i+1
rstCoupon.MoveNext
Loop
%>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>