<%
if Request.QueryString("page").Count > 0 then
currentPage = Int(Request.QueryString("page"))
else
currentPage = 1
end if
previousPage = currentPage - 1
nextPage = currentPage + 1
Set connection = Server.CreateObject("ADODB.Connection")
connection.Open connectionStringNews
Set command = Server.CreateObject("ADODB.Command")
command.ActiveConnection = connection
command.CommandText = "SELECT TOP 15 * FROM specials WHERE id NOT IN (SELECT TOP " & previousPage*15 & " id FROM specials ORDER BY createTime DESC) ORDER BY createTime DESC"
Set resultSet = command.Execute
%>
<%
i = -1
While resultSet.EOF = False
i = i + 1
if Int(i/3)*3 = i and i <> 0 then
%>
<%
end if
%>
|
|
<%
resultSet.MoveNext
Wend
select case Int(i/3)
case 1
%>
| |
<%
case 2
%>
|
<%
end select
%>
<%
resultSet.Close
Set resultSet = Nothing
Set command = Server.CreateObject("ADODB.Command")
command.ActiveConnection = connection
command.CommandText = "SELECT COUNT(*) amount FROM specials"
Set resultSet = command.Execute
amount = resultSet("amount")
pages = Int(amount/15)
if amount <> pages*15 then
pages = pages + 1
end if
resultSet.Close
Set resultSet = Nothing
connection.Close
Set connection = Nothing
%>