<%
dim pagina
pagina=1
if request.querystring("pag")<>"" then
pagina=int(request.querystring("pag"))
end if
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & _
Server.MapPath("mdb-database/login.mdb")
Dim objRS
Set objRS = Server.CreateObject("ADODB.RecordSet")
sSQL="SELECT * FROM tblNews WHERE (tblNews.tipo=1 AND tblNews.attiva=True) ORDER BY tblNews.Timestamp;"
objRS.Open sSQL, objConn, 3, 3
%>
<div ="1">
<%
if not objRS.EOF then
dim differenzaDate
dim page
page=1
if request.QueryString("pag")<>"" then
page=int(request.QueryString("pag"))
end if
dim perPagina
perPagina=5
objRS.pageSize=perPagina
objRS.absolutePage=page
for i=1 to perPagina
if not objRS.eof then
ID=objRS("ID")
Heading=objRS("Heading")
Timestamp=objRS("Timestamp")
Content= left(objRS("Content"),90) & " ...[continua]"
PostedBy=objRS("PostedBy")
differenzaDate = DateDiff("d", objRS("Timestamp"), Date)
if (objRS("giorni") = 0) or ( differenzaDate <= objRS("giorni") ) then
%>
<%if objRS("img")= true Then
Response.Write ("<div id='news'><div id='newsdx'>[img]imgNews/" & objRS("ID") & ".jpg[/img]</div>")
end if
%>
<%=Heading%>
<%=Timestamp%>
<%=Content%>
<%=PostedBy%>
<%
end if
objRS.movenext
end if
next
response.write "
Vedi:"
for i=1 to objRS.pagecount
if i<>page then
%> - <%= i %> - <%
else
%><%= i %> <%
end if
next
else
%>
Nessun record trovato
<%
end if
objRS.Close
%>
</div>
"qui sotto devo dichiarare un altra variabile poichè quella che ho scritto io è identica"
<div id="2">
<%
sSQL="SELECT * FROM tblNews WHERE (tblNews.tipo=2 AND tblNews.attiva=True) ORDER BY tblNews.Timestamp;"
objRS.Open sSQL, objConn, 3, 3
%>
<%
if not objRS.EOF then
dim differenzaDate
dim page
page=1
if request.QueryString("pag")<>"" then
page=int(request.QueryString("pag"))
end if
dim perPagina
perPagina=5
objRS.pageSize=perPagina
objRS.absolutePage=page
for i=1 to perPagina
if not objRS.eof then
ID=objRS("ID")
Heading=objRS("Heading")
Timestamp=objRS("Timestamp")
Content= left(objRS("Content"),90) & " ...[continua]"
PostedBy=objRS("PostedBy")
differenzaDate = DateDiff("d", objRS("Timestamp"), Date)
if (objRS("giorni") = 0) or ( differenzaDate <= objRS("giorni") ) then
%>
<%if objRS("img")= true Then
Response.Write ("<div id='news'><div id='newsdx'>[img]imgNews/" & objRS("ID") & ".jpg[/img]</div>")
end if
%>
<%=Heading%>
<%=Timestamp%>
<%=Content%>
<%=PostedBy%>
<%
end if
objRS.movenext
end if
next
response.write "
Vedi:"
for i=1 to objRS.pagecount
if i<>page then
%> - <%= i %> - <%
else
%><%= i %> <%
end if
next
else
%>
Nessun record trovato
<%
end if
objRS.Close
%>
</div>

Rispondi quotando