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

    errore nella paginazione

    mi dite qual'è il problema?
    io non riesco a capire...
    Errore di run-time di Microsoft VBScript error '800a01f5'

    Assegnazione non valida: 'I'

    /admin/elenco.asp, riga 160
    codice:
    <%
    	iPageSize = 20 'NUMERO RECORD PER PAGINA
    
    	If Request.QueryString("page") = "" Then
    		iPageCurrent = 1
    	Else
    		iPageCurrent = CInt(Request.QueryString("page"))
    	End If
    	Set conn = Server.CreateObject("ADODB.Connection")
    	conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("/mdb-database/dbab.mdb")
    	sql = "select id, nome from negozio order by nome;"
    	
    	set rs = Server.CreateObject("ADODB.Recordset") 
    	rs.PageSize = iPageSize
    	rs.CacheSize = iPageSize
    	rs.Open sql, conn, adOpenStatic, adLockReadOnly, adCmdText
    
    	reccount = rs.recordcount
    	iPageCount = rs.PageCount
    
    	If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    	If iPageCurrent < 1 Then iPageCurrent = 1
    
    	If iPageCount = 0 Then
    		Response.Write "<p class=""Stile1"">Nessun elemento</p>"
    	Else
    		rs.AbsolutePage = iPageCurrent
    		iRecordsShown = 0
    	
    	cont=1
    	response.Write("<table border=""0"" width=""80%"">")
    		response.Write("<tr>")
    		response.Write("<td width=""25%"">Nome</td>")
    		response.Write("<td width=""25%"">Modifica</td>")
    		response.Write("<td width=""25%"">Elimina</td>")
    		response.Write("<td width=""25%"">Assegna Categoria</td>")
    		response.Write("</tr>")
    	Do While iRecordsShown < iPageSize And Not rs.EOF
    		Dim Rig, bg
    		Rig = Rig + 1
    		
    		nomenegozio = rs("nome")
    		idnegozio = rs("id")
    		response.Write("<tr>")
    		response.Write("<td width=""25%"">"&nomenegozio&"</td>")
    		response.Write("<td width=""25%"">Modifica</td>")
    		response.Write("<td width=""25%"">Elimina</td>")
    		response.Write("<td width=""25%"">Assegna Categoria</td>")
    		response.Write("</tr>")
    		
    		
    		Cont = Cont + 1
    		'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
    		iRecordsShown = iRecordsShown + 1
    		rs.MoveNext
    	Loop
    	response.Write("</table>")
    	'PULIZIA DEGLI OGGETTI ADO
    	rs.Close
    	Set rs = Nothing
    	
    	End if
    	If iPageCount <> 1 Then
    	
    	'>>>>>>>>>>>>>>>>>>>>>>>
    	%>
        <p class="Stile1">[
    <%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%> 'riga 160
    	<%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%>	
    	]
        </p>
        
        
        <div align="center"><p class="Stile1"> Pagina <%=iPageCurrent%> di <%=iPageCount%></p></div>
        
    	
    	
    	<%
    	end if
    			
    	conn.Close
    	Set conn=Nothing 
    				%>
    stex1984

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Verifica quanto valgono le due variabili: "da_pag" e "fino_a_pag"

    Roby

  3. #3
    da pag:1
    fino a pag:3
    stex1984

  4. #4
    ho risolto
    il codice funge perfettamente
    avevo un file incluso nell'header che conteneva una varibile i gia dichiarata e faceva conflitto
    è bastati rinominare i in ic e tutto fila liscio..
    grazie!!!
    stex1984

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.