Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    seconda pagina che non va

    ho messo 7 news per pagina ma quando vado alla seconda pagina mi esce ?pag=2

    sicuramente tralascio qualcosa ecco il codice

    codice:
    <%@LANGUAGE="VBSCRIPT"%> 
     
    
    <%
    dim LCID 
    LCID = 1040 
    Session.LCID=LCID 
    on error resume next
    parola=request.QueryString("parola")
    Dim cn
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.ConnectionString="dsn=vincere;"
    cn.open
    
    Dim rs, sql
    Set rs = Server.CreateObject("ADODB.Recordset")
    
    
    sql = "SELECT data, stralcio, id, vincita FROM news WHERE testo LIKE '%"&parola&"%' ORDER by data DESC, id DESC "
    
     
    
    Set rs.ActiveConnection = cn
    rs.CursorType = adOpenKeyset
    rs.LockType = adLockOptimistic
    rs.Open sql, cn
    
    rs_numRows = 0
    
    
    
    
    
    
    Dim Repeat1__numRows
    Dim Repeat1__index
    
    Repeat1__numRows = 10
    Repeat1__index = 0
    Numerazione_Max = 7
    rs_numRows = rs_numRows + Repeat1__numRows
    
    rs.PageSize = Repeat1__numRows
    
    
    Pag = CInt(Request.Querystring("pag"))
    
    
    If (Not rs.Eof) Then
      If Pag>rs.PageCount Then
        Pag = rs.PageCount
      End If
      If Pag = 0 Then
        Pag = 1
      End If
    
     
      rs.AbsolutePage = Pag
    
     
      indice_inizio = pag-(Numerazione_Max/2)
      If (indice_inizio>(rs.PageCount-Numerazione_Max)) Then
        indice_inizio = rs.PageCount-Numerazione_Max+1
      End If
      If (indice_inizio<=0) Then
        indice_inizio = 1
      End if
      indice_fine=indice_inizio+Numerazione_Max-1
      If (indice_fine>rs.PageCount) Then
        indice_fine = rs.PageCount
      End If
      indice_inizio = CInt(indice_inizio)
    indice_fine = CInt(indice_fine)
      
      Link = "Primo record   "
    
     
      If (indice_inizio<>1) Then
        Link=Link&"... "
      End If
      For i=indice_inizio to indice_fine
    
      
      If (i=pag) then
        Link = Link&"]"&i&"["
      
      Else
        Link = Link&"["&i&"]"
      End If
      Next
    
     
      If (indice_fine<rs.PageCount-1) Then
        Link = Link&"... "
      End If
    
     
      Link=Link&" Ultimo record  "
    End If
    
    
    
    Dim rs_total
    Dim rs_first
    Dim rs_last
    
    ' set the record count
    rs_total = rs.RecordCount
    
    ' FINE DEL PRIMO PEZZO ------------------------
    
    
    
    
    %>
    inizio poi dove escono le news
    codice:
     <% cont=0
    While ((Repeat1__numRows <> 0) AND (NOT rs.EOF)) 
    
    if cont mod 2 = 0 then
    
    bgcolor="#E4E3FD"
    		
    else
    bgcolor="#f1f4f6"
    end if
    
    cont=cont+1
    %>
    
    
    
    
    <div class="centro1"><div class="box"><%=rs("data")%>
    
    							&amp;pag=<%=pag%>"><%=rs("stralcio")%>
                              
    <%=rs("vincita")%></div></div> 
    						  
    		 <%
      Repeat1__index=Repeat1__index+1
      Repeat1__numRows=Repeat1__numRows-1
      rs.MoveNext()
    Wend
    %>
    		 
    		 
    		 
    'questo è per andare avanti di una pagina 		 
    		 
    <div class="box"><%=Response.Write(Link)%></div></div> 
    
    <%
    rs.Close
    Set rs=Nothing
    cn.Close
    Set cn=Nothing
    %>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non hai messo il nome dell apagina in tutto il blocco...
    Ad esempio:

    codice:
    href="Pagina???"?pag=1"">
    Roby

  3. #3
    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /news.asp, line 75

    Link = "Primo record "


  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Hai inventato una nuova sintassi...
    codice:
    Link = "Primo record "
    Roby

  5. #5

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.