Visualizzazione dei risultati da 1 a 8 su 8

Discussione: paginazione

  1. #1

    paginazione

    Scusate ma non trovo la discussione precedente nella quale si parlava di questo problema e quindi ne ho aperta una nuova.
    Pensavo andasse tutto bene in questa paginazione ma......
    non capisco perche mi deve funzionare per tutte le opzioni tranne per l'opzione eta.
    Il ragionamento è uguale per tutte le variabili ma non funziona per eta
    Perfavore potreste correggere il problema?????

    LO SCRIPT E' ON LINE QUI

    codice:
    iPageSize = 5 'NUMERO RECORD PER PAGINA
    
    If Request.QueryString("page") = "" Then
    iPageCurrent = 1
    Else
    iPageCurrent = CInt(Request.QueryString("page"))
    End If
    '***********************costruisco la SELECT *************************
    Dim strSQL , VarEta , link
    
    strSQL = "SELECT * FROM schede"
    strTXT = ""
    
    If Request("regione") <> "" Then
    strTXT = " regione = '" & Request("regione") &"'"
    end if
    
    If Request("provincia") <> "" Then
    if strTXT = "" then
    strTXT = " provincia = '" & Request("provincia") & "'"
    else
    strTXT = strTXT & " AND provincia = '" & Request("provincia") & "'"
    end if
    end if
    
    if Request("sesso") <> "" Then
    if strTXT = "" then
    strTXT = " sesso = '" & Request("sesso") &"'"
    else
    strTXT = strTXT & " AND sesso = '" & Request("sesso") & "'"
    end if
    end if
    
    if Request("foto") <> "" Then
    if strTXT = "" then
    strTXT = " foto = '" & Request("foto") &"'"
    else
    strTXT = strTXT & " AND foto = '" & Request("foto") & "'"
    end if
    end if
    
    
    
    Select Case Request("eta")
    Case 1
    VarEta = "Between '18' And '30'" 
    Case 2
    VarEta = "Between '31' And '40'"
    Case 3
    VarEta = "Between '41' And '50'"
    Case 4
    VarEta = "Between '51' And '60'"
    Case 5
    VarEta = "Between '61' And '99'"
    Case Else
    VarEta = "0"
    End Select
    
    
    if VarEta <> "0" Then
    if strTXT = "" then
    strTXT = " eta " & VarEta
    else
    strTXT = strTXT & " AND eta " & VarEta
    end if
    end if 
    
    if strTXT <> "" then
    strSQL = strSQL &" WHERE"& strTXT
    end if
    
    strSQL = strSQL & " ORDER BY cognome ASC"
    
    '***********************link pagine successive ****************
    link = "default_avanzata.asp?"
    linkstrTXT = ""
    
    If Request("regione") <> "" Then
    linkstrTXT = "regione=" & Request("regione")
    end if
    
    If Request("provincia") <> "" Then
    if linkstrTXT = "" then
    linkstrTXT = "provincia=" & Request("provincia")
    else
    linkstrTXT = linkstrTXT & "&provincia=" & Request("provincia")
    end if
    end if
    
    if Request("sesso") <> "" Then
    if linkstrTXT = "" then
    linkstrTXT = "sesso=" & Request("sesso")
    else
    linkstrTXT = linkstrTXT & "&sesso=" & Request("sesso")
    end if
    end if
    
    if Request("foto") <> "" Then
    if linkstrTXT = "" then
    linkstrTXT = "foto=" & Request("foto")
    else
    linkstrTXT = linkstrTXT & "&foto=" & Request("foto")
    end if
    end if
    
    
    
    Select Case Request("eta")
    Case 1
    VarEta = "Between '18' And '30'" 
    Case 2
    VarEta = "Between '31' And '40'"
    Case 3
    VarEta = "Between '41' And '50'"
    Case 4
    VarEta = "Between '51' And '60'"
    Case 5
    VarEta = "Between '61' And '99'"
    Case Else
    VarEta = "0"
    End Select
    
    
    if VarEta <> "0" Then
    if linkstrTXT = "" then
    linkstrTXT = " eta " & VarEta
    else
    linkstrTXT = linkstrTXT & "&eta=" & VarEta
    end if
    end if 
    
    if linkstrTXT <> "" then
    link = link & linkstrTXT & "&page"
    else 
    link = link & "page"
    end if
    
    response.Write(strSQL)
    response.Write("
    ")
    response.Write(link)
    response.Write(Request.QueryString("page"))
    response.Write("
    ")
    response.Write("ETA =" & Request("eta") )
    response.Write("
    ")
    
    
    '******************************************* 
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.PageSize = iPageSize
    objRS.CacheSize = iPageSize
    objRS.Open strSQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
    
    reccount = objRS.recordcount
    iPageCount = objRS.PageCount
    
    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    If iPageCurrent < 1 Then iPageCurrent = 1
    
    If iPageCount = 0 Then
    Response.Write "
    
    <table><td><font face='verdana' size='3' color='#000000'><align center>Non sono state trovate schede</td></table></center></p>"
    Else
    objRS.AbsolutePage = iPageCurrent
    iRecordsShown = 0
    %>
    <table cellpadding="0" cellspacing="0" border="0" align="center" width="100%">
    <tr>
    <td bgcolor="#cccccc">
    <table cellpadding="2" cellspacing="1" border="0" width="100%">
    <tr height="22">
    <td bgcolor="#dddddd" WIDTH="4%"align="center"><font face="verdana" size="1" color="#000000">[b]N°</font></td> 
    <td bgcolor="#dddddd" WIDTH="12%" align="center"><font face="verdana" size="1" color="#000000">Cognome e Nome </font></td> 
    <td bgcolor="#dddddd" WIDTH="12%" align="center"><font face="verdana" size="1">Email</font></td> 
    <td bgcolor="#dddddd" WIDTH="5%" align="center"><font size="1" face="verdana">Sesso</font></td> 
    <td bgcolor="#dddddd" WIDTH="5%" align="center"><font size="1" face="verdana">Et&agrave;</font></td>
    <td bgcolor="#dddddd" WIDTH="5%" align="center"><font face="verdana" size="1">Prov.</font></td> 
    <td bgcolor="#dddddd" WIDTH="30%" align="center"><font face="verdana" size="1">Descrizione</font></td> 
    <td bgcolor="#dddddd" WIDTH="10%" align="center"><font face="verdana" size="1">Foto 1</font></td>
    <td bgcolor="#dddddd" WIDTH="10%" align="center"><font face="verdana" size="1">Foto 2</font></td>
    </tr>
    <%
    'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL
    'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA
    cont=1
    Do While iRecordsShown < iPageSize And Not objRS.EOF
    Dim Rig, bg
    Rig = Rig + 1
    If Rig Mod 2 = 0 then
    bg = "#E4E4E4"
    Else
    bg = "#ccccff" 
    End if 
    Response.Write "<tr bgcolor = " & bg & "><td><font color='#000000' face='Verdana' size='2'><center>" & (iPageSize*iPageCurrent)-iPageSize+Cont & "</font></td>"
    Response.write "<td><font color='#000000' face='Verdana' size='1'><A HREF='../visualizza/scheda_utente.asp?email=" 
    Response.Write( objRS("email") )
    Response.write "'>"
    Response.Write( objRS("cognome") & " " & objRS("nome") )
    Response.write "</A>
    </font></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'><center>" & objRS("email") & "</font></center></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'><center>" & objRS("sesso") & "</font></center></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'><center>" & objRS("eta") & "</font></center></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'><center>" & objRS("provincia") & "</font></center></td>"
    Response.Write "<td><font color='#000000' face='Verdana' size='1'>" & objRS("descrizione") & "</font></td>" 
    Response.Write "<td> <center> [img] & objRS([/img]</center></td>"
    Response.Write "<td> <center> [img] & objRS([/img]</center></td>"
    Cont = Cont + 1
    'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
    iRecordsShown = iRecordsShown + 1
    objRS.MoveNext
    Loop
    'PULIZIA DEGLI OGGETTI ADO
    objRS.Close
    Set objRS = Nothing
    %>
    </table>
    </td>
    </tr>
    </table>
    <%End if%>
    
    
    
    <%If ipagecount <> 1 Then%>
    <center>
    <table>
    <tr valign="middle">
    <td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000">
    [
    <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%>
    [img]images/first.gif[/img]
    <%end if%>
    <%if iPageCurrent > 1 then%>
    [img]images/pre.gif[/img]
    <%end if%>
    <%if iPageCount > 2 then
    if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2
    if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2
    else
    da_pag = 1
    fino_a_pag = iPageCount
    end if%>
    <%for i = da_pag to fino_a_pag%>
    <%if i = iPageCurrent then%>
    <font color="red"><%=i%></font>
    <%else%> 
    <%=i%>
    <%end if%> 
    <%next%>
    <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%>
    [img]images/next.gif[/img]
    <%end if%> 
    <%if iPageCurrent+1 < iPageCount then%>
    [img]images/last.gif[/img]
    <%end if%> 
    ]
    </font></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><font face="verdana" size="1" color="#000000">
    <center>
    Pagina
    <font color="#FF0000"><%=iPageCurrent%></font>
    di
    <font color="#FF0000"><%=iPageCount%></font>
    </center>
    </font></td>
    </tr>
    </table>
    </center>
    <%end if%>
    <%
    Conn.Close
    Set objConn = Nothing
    %>
    </TD>
    </TR>
    </TABLE>
    ..: Serie A :..
    ..: FORZA PALERMOOOOoooo.....

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Il campo eta che tipo di campo è?

    Roby

  3. #3
    IL campo eta nel database è di tipo TESTO
    ..: Serie A :..
    ..: FORZA PALERMOOOOoooo.....

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Prov a farlo numerico e a togliere gli apici nelle between.

    Roby

  5. #5
    NON FUNZIONA LO STESSO
    con "tutte l'eta" va perfettametne
    appena seleziono un'eta si incasina

    Between della select:

    codice:
    Select Case Request("eta")
    Case 1
    VarEta = "Between 18 And 30" 
    Case 2
    VarEta = "Between 31 And 40"
    Case 3
    VarEta = "Between 41 And 50"
    Case 4
    VarEta = "Between 51 And 60"
    Case 5
    VarEta = "Between 61 And 99"
    Case Else
    VarEta = "0"
    End Select
    
    
    if VarEta <> "0" Then
    if strTXT = "" then
    strTXT = " eta " & VarEta
    else
    strTXT = strTXT & " AND eta " & VarEta
    end if
    end if

    Between dei link:
    codice:
    Select Case Request("eta")
    Case 1
    VarEta = "Between 18 And 30" 
    Case 2
    VarEta = "Between 31 And 40"
    Case 3
    VarEta = "Between 41 And 50"
    Case 4
    VarEta = "Between 51 And 60"
    Case 5
    VarEta = "Between 61 And 99"
    Case Else
    VarEta = "0"
    End Select
    
    
    if VarEta <> "0" Then
    if linkstrTXT = "" then
    linkstrTXT = " eta " & VarEta
    else
    linkstrTXT = linkstrTXT & "&eta=" & VarEta
    end if
    end if
    ..: Serie A :..
    ..: FORZA PALERMOOOOoooo.....

  6. #6
    prova:
    FOTO SI
    DAI 18 AI 30

    ECCO UN ALTRO ERRORE A PAGINA 2 VVoVe:

    codice:
    Microsoft VBScript runtime error '800a000d' 
    
    Type mismatch: '[string: "Between 18 And 30"]' 
    
    /public/ricerca/default_avanzata.asp, line 69
    codice:
    Select Case Request("eta")   
    Case 1
    VarEta = "Between 18 And 30" 
    Case 2
    VarEta = "Between 31 And 40"
    ..: Serie A :..
    ..: FORZA PALERMOOOOoooo.....

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Trasforma:

    codice:
    VarEta = "eta > 18 And eta < 30"
    ecc...

    Roby

  8. #8
    i problemi li ho sempre quando passo alle pagine successive alla prima
    la prima volta mi da tutto ok sia la select che il link ( come conferma il response sopra la tabella)
    poi si incasina.

    HO AGGINTO SOLO
    codice:
    VarEta = "> 31 And eta < 40"
    ALTRIMENTI AVREI RIPETUTO eta
    ..: Serie A :..
    ..: FORZA PALERMOOOOoooo.....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.