Ho un problema di paginazione. Funziona sulla prima pagina ma non sulla seconda nel senso che quando clicco su pagina successiva la pagina risulta vuota. Non capisco dive sbaglio.
Questo è il codice della pagina:
Sub DrawResults()
Dim Keyword, Keyword02, SQL, j, TheSet, ConnObj, iResultCount, iPageCount, iPageCurrent, iPageSize, Reviews, ReviewCount, GetOverallRating
Keyword = trim(replace(Request.Form("keyword"),"'","''",1))
Keyword02 = trim(replace(Request.Form("keyword02"),"'","''",1) )
SQL = "SELECT Top 3000 * FROM Tabella_Siti WHERE "
if Keyword="" and Keyword02="" then
response.write "<font class='general_page_header'>"
response.write("Attenzione: devi inserire alemno un valore per eseguire la ricerca")
response.write "</font>"
response.end
end if
If Keyword <> "" then
SQL = SQL & "Tabella_Siti.Descrizione LIKE '%" & Keyword & "%' AND "
End if
If Keyword02 <> "" then
SQL = SQL & "Tabella_Siti.Provincia = '" & Keyword02 & "' OR "
SQL = SQL & "Tabella_Siti.Prov = '" & Keyword02 & "' OR "
SQL = SQL & "Tabella_Siti.Citta = '" & Keyword02 & "' OR "
SQL = SQL & "Tabella_Siti.Regione = '" & Keyword02 & "' OR "
End if
If right(SQL,3) = "OR " then SQL = left(SQL,len(SQL)-3) & "AND "
if DatabaseType = "Access" then
SQL = SQL & "(PublishOnWeb = True)"
else
SQL = SQL & "(PublishOnWeb = 1)"
end if
if request.form("order") = "created" then
SQL = SQL & " ORDER BY Tabella_Siti.Created "
elseif request.form("order") = "title" then
SQL = SQL & " ORDER BY Title "
elseif request.form("order") = "Descrizione" then
SQL = SQL & " ORDER BY Descrizione "
elseif request.form("order") = "servizi" then
SQL = SQL & " ORDER BY Servizi "
end if
if request.form("sort") = "ASC" then
SQL = SQL & "ASC"
elseif request.form("sort") = "DESC" then
SQL = SQL & "DESC"
end if
if Debug = True then response.write SQL
If request.queryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(request.queryString("page"))
End If
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Open MyConnStr
Set TheSet = Server.CreateObject("ADODB.Recordset")
TheSet.CursorLocation = 3
TheSet.PageSize = LinksPerPage
TheSet.Open SQL, ConnObj
iPageCount = TheSet.PageCount
Response.write "<table width='100%' align='center' cellpadding='7' cellspacing='0'>"
if TheSet.EOF or TheSet.BOF then ' no records found
response.write "<tr><td valign='top'></td></tr>"
response.write "<tr><td bgcolor='#F9F9F9'>"
response.write "<font class='general_text'>"
response.write "Non sono stati trovati dati."
response.write "</font>"
response.write "</td></tr>"
response.write "<tr><td bgcolor='#ffffff'>"
response.write "<font class='general_text'>"
response.write "Riprova la ricerca con altri criteri"
response.write "</font>"
response.write "</td>"
response.write "</tr>"
else
if Keyword = "" then
response.write "<tr><td valign='top'></td></tr>"
response.write "<tr><td>"
response.write "<font class='general_page_header'>"
response.write "Attenzione devi inserire cosa vuoi cercare !"
response.write "</font>"
response.write "</td></tr>"
end if
if Keyword02 = "" then
response.write "<tr><td valign='top'></td></tr>"
response.write "<tr><td>"
response.write "<font class='general_page_header'>"
response.write "Attenzione devi inserire il luogo !"
response.write "</font>"
response.write "</td></tr>"
end if
if Keyword <> "" then
response.write "<tr><td valign='top'></td></tr>"
response.write "<tr><td bgcolor='#F9F9F9'>"
response.write "<font class='general_page_header'>"
response.write "Risultati della ricerca per " & Keyword
response.write "</font>"
response.write "</td></tr>"
end if
response.write "<tr><td valign='top'></td></tr>"
response.write "<tr><td bgcolor='#ffffff'>"
response.write "<font class='page_results_count'>"
response.write TheSet.RecordCount & " risultati trovati"
response.write "</font>"
response.write "</td></tr>"
If 1 > iPageCurrent Then iPageCurrent = 1
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
TheSet.AbsolutePage = iPageCurrent
iResultCount = (iPageSize * (iPageCurrent - 1)) + 1
if NoCats = False then response.write "<tr><td bgcolor='" & CellSpilt & "'></td></tr>"
response.write "<tr><td>"
response.write "<table cellspacing='0' cellpadding='0' width='100%'>"
response.write "<tr><form><td>"
response.write "<font class='page_results_count'>"
response.write "Pagina " & iPageCurrent & " di " & iPageCount & " - " & TheSet.RecordCount
response.write " risultati</font>"
response.write "</td><td align='right'>"
response.write "<select name='order' onchange=""javascript:if (this.value != '') {self.location = '"
response.write "cerca_rb.asp?page=" &_
iPageCurrent & "&order=' + this.value + '&sortorder=' + sort.value + '&id=" & ID & "&parentID="
response.write ParentID & "';}"">"
response.write "<option value=''"
if request.querystring("order") = "" then response.write "selected"
response.write ">Ordina...</option>"
response.write "<option value='TIT'"
if request.querystring("order") = "TIT" then response.write "selected"
response.write ">Ordina : Nome</option>"
response.write "<option value='PRO'"
if request.querystring("order") = "PRO" then response.write "selected"
response.write ">Ordina : Provincia</option>"
response.write "</select>"
response.write ""
response.write "<select name='sort' onchange=""javascript:self.location = '"
response.write "cerca_rb.asp?page=" &_
iPageCurrent & "&order=' + order.value + '&sortorder=' + this.value + '&id="
response.write ID & "&parentID=" & ParentID & "';"">"
response.write "<option value='ASC'"
if request.querystring("sortorder") = "ASC" then response.write "selected"
response.write ">Crescente</option>"
response.write "<option value='DESC'"
if request.querystring("sortorder") = "DESC" then response.write "selected"
response.write ">Decrescente</option>"
response.write "</select>"
response.write "</td></form></tr></table>"
response.write "</td></tr>"
Do While TheSet.AbsolutePage = iPageCurrent And Not TheSet.EOF
response.write "<tr><td colspan='2'></td></tr>"
response.write "<tr><td>"
response.write "<a class='listing_head' href='" & Path2Directory & "rb_dett.asp?siteid=" & TheSet("ID") & "' title='"
response.write TheSet("Title") & "' target='_parent'>"
If len(TheSet("Title")) >= 40 then
response.write left(TheSet("Title"),40) & "..."
else
response.write TheSet("Title")
end if
response.write "</a>"
response.write "
"
response.write "<font class='listing_Descrizione'>"
if TheSet("cap") <> "" then response.write TheSet("cap")
response.write ""
if TheSet("citta") <> "" then response.write TheSet("citta")
response.write ""
if TheSet("prov") <> "" then
response.write "("
response.write TheSet("prov")
response.write ")"
end if
response.write ""
if TheSet("indirizzo") <> "" then
response.write ""
response.write "-"
response.write ""
response.write TheSet("indirizzo")
end if
response.write "
"
if TheSet("tel") <> "" then
response.write "Tel:"
response.write ""
response.write TheSet("tel")
end if
response.write ""
if TheSet("fax") <> "" then
response.write "Fax:"
response.write ""
response.write TheSet("fax")
end if
response.write "</font>"
response.write "
"
response.write "<table width='100%' cellspacing='0' cellpadding='0'><tr><td>"
'*********************************
'*** inserimento Vedi scheda ***
response.write "<a class='bookmark_resource' href='" & Path2Directory & "rb_dett.asp?siteID="
response.write TheSet("ID") & "' title='"
response.write TheSet("Title") & "' target='_parent'>"
response.write "</a>"
response.write "<a class='bookmark_resource' href='" & Path2Directory & "rb_dett.asp?siteID="
response.write TheSet("ID") & "' title='"
response.write TheSet("Title") & "' target='_parent'>"
response.write "Vedi Scheda</a>"
'*** inserimento Vedi scheda ***
'*********************************
if TheSet("URL") <> "" then
response.write " | "
response.write "<font class='short_listing_url'>"
response.write "<a href='" & Path2Directory & "vai_sito.asp?id=" & TheSet("ID") & "' class='short_listing_url' target='_blank'>"
response.write "Internet"
response.write "</a>"
response.write "</font>"
end if
response.write "</td>"
response.write "</tr>"
response.write "<tr>"
response.write "<td>"
response.write "Categorie: "
response.write " "
i = 0
ConstructTopNavigation TheSet("CategoryID")
response.write TopNavLinks
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</td></tr>"
response.write "<tr><td class='TDtabella_view02'>"
response.write " "
response.write "</td></tr>"
iResultCount = iResultCount + 1
TheSet.MoveNext
Loop
response.write "<tr>"
response.write "<td valign='top'>"
response.write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
response.write "<tr><td width='20%' class='paging_links' align='left'>"
If iPageCurrent > 1 Then
response.write "«<a class='paging_links' href='cerca_rb.asp?page="
response.write iPageCurrent - 1
response.write "&order=" & request.querystring("order")
response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID & "&parentID="
response.write ParentID & "'>Pagina Precedente</a>"
end if
response.write "</td>"
response.write "<td width='60%' class='paging_links' align='center'>"
dim intStart, intEnd
if iPageCount <> 1 then
if iPageCurrent <= intPGCount Then
intStart = 1
Else
If (iPageCurrent Mod intPGCount) = 0 Then
intStart = iPageCurrent - intPGCountMinus
Else
intStart = iPageCurrent - (iPageCurrent Mod intPGCount) + 1
End if
End if
intEnd = intStart + intPGCountMinus
if intEnd > iPageCount Then intEnd = iPageCount
for i = intStart to intEnd
if i = intStart and i <> 1 then response.write "... "
if i = iPageCurrent then
response.write "<font class='paging_links'>[ " & i & " ]</font>"
else
response.write "<a class='paging_links' href='cerca_rb.asp?page=" & i
response.write "&order=" & request.querystring("order")
response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID
response.write "&parentID=" & ParentID & "'>" & i & "</a>"
end if
if i <> intEnd then
response.write ""
else
if i <> iPageCount then response.write "..."
end if
next
end if
response.write "</td>"
response.write "<td width='20%' class='paging_links' align='right'>"
If iPageCurrent <> iPageCount Then
response.write "<a class='paging_links' href='cerca_rb.asp?page="
response.write iPageCurrent + 1
response.write "&order=" & request.querystring("order")
response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID & "&parentID="
response.write ParentID & "'>Pagina Successiva</a>»"
end if
response.write "</td></tr></table>"
end if
response.write "</td></tr>"
response.write "</table>"
Set TheSet = Nothing
ConnObj.Close
End Sub

Rispondi quotando
