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

    Link a relativa scheda da paginazione

    Ciao a tutti, ho un problema con delle modifiche di una paginazione.

    Allora, attualmente mi vengono mostrati in paginazione i campi del database che mi interessano.
    Ora vorrei che cliccando su uno dei campi (associazione) mi si rimandi ad una pagina scheda.asp che richiami ulteriori dati aggiuntivi (dell'associazione)

    Questo è il codice dove ho anche cercato di fare il link nel punto specifico.
    Come creo correttamente il link e come posso impostare la pagina che deve visualizzare i risultati?
    Grazie mille


    codice:
    <%
    option explicit
    
    function excess(argValue)
    	if not (int(argValue) = argValue) then argValue = int(argValue)+1	
    	excess = argValue
    end function
    
    
    function cleanLong(argValue)
    	on error resume next
    	if argValue = "" then : cleanLong = clng(0) : else : cleanLong = clng(trim(argValue)) : end if
    	if err.number <> 0 then cleanLong = 0
    	on error goto 0
    end function
    
    dim conn, rs, SQL, SQLwhere
    Set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")
    Conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = " & server.mappath("/mdb-database/database.mdb") & " ; Persist Security Info = False"
    
    dim wbp_recordPerPage, wbp_totalRecords, wbp_totalPages, wbp_currentRecord, wbp_currentPage, wbp_lastcurrentRecord
    dim wbp_isEmpty
    dim wbp_baseQuerystring, wbp_basePage
    dim argPage
    
    '*** EDIT *** impostare quanti record in ogni pagina
    wbp_recordPerPage = 2
    
    argPage = cleanLong(request.QueryString("page"))
    if argPage < 1 then argPage = 1
    
    '* 1. selezionare SOLO gli id
    '* 2. applicare in questa query gli eventuali filtri di selezione
    SQL = "SELECT id FROM tabella_ricerca"
    rs.open SQL, Conn, 3, 3
    
    '* impostazione variabili di navigazione (pagine)
    wbp_totalRecords = cint(rs.recordcount)
    wbp_totalPages = excess(wbp_totalRecords / wbp_recordPerPage)
    wbp_currentRecord = ((argPage - 1) * wbp_recordPerPage) + 1
    if wbp_currentRecord > wbp_totalRecords then
    	wbp_currentPage = 1
    	wbp_currentRecord = ((wbp_currentPage - 1) * wbp_recordPerPage) + 1
    else
    	wbp_currentPage = argPage
    end if
    wbp_lastcurrentRecord = wbp_currentRecord + wbp_recordPerPage - 1
    if wbp_lastcurrentRecord > wbp_totalRecords then wbp_lastcurrentRecord = wbp_totalRecords
    
    SQLwhere = ""
    
    wbp_isEmpty = true
    
    if not rs.eof then
    	'* spostamento nel recordset
    	rs.pagesize = wbp_recordPerPage
    	rs.absolutepage = wbp_currentPage
    
    	wbp_isEmpty = false
    	
    	'* creazione seconda query (recordset completo, solo per gli ID selezionati nella prima query)
    	dim ii
    	for ii=0 to wbp_recordPerPage-1
    		'*** EDIT *** al posto di ID mettere il nome del campo ID della vostra tabella
    		SQLwhere = SQLwhere & " or id = " & rs("id") & ""
    		rs.movenext
    		if rs.eof then exit for
    	next
    	set ii = nothing
    	rs.close
    	SQLwhere = right(SQLwhere,len(SQLwhere)-3)
    end if
    
    if not wbp_isEmpty then
    
    	'*** EDIT *** selezionare TUTTI i campi necessari
    	SQL = "SELECT id, fuoriprovincia, denominazione, associazione, indirizzo, SitoInternet, Telefono, DisciplinePraticate, logo FROM tabella_ricerca WHERE " & SQLwhere & " ORDER BY associazione ASC"
    
    	set rs = conn.execute(SQL)
    	while not rs.eof
    		'*** EDIT *** STAMPA DEL RECORDSET (da personalizzare secondo le esigenze)
    
    Response.Write "<table border='1' width='100%' cellspacing='0' cellpadding='0'>" & "<tr>" 
    Response.Write "<td width='70%' valign='top'>" & "<p align='center'>" 
    Response.Write "<p align='center'>" & "<font face='verdana' size='2' color='#FF0000'>" & rs("FuoriProvincia") &"    " & "</font>"
    Response.Write rs("denominazione")  &"    " & "" & "<font face='Verdana' color='#008080'>" &  rs("associazione") & "</font>" & "</p>" & ""
    Response.Write "<p align='center'>" & "<font face='verdana' size='2'>" & rs("indirizzo")
    Response.Write "<p align='left'>" & "" &"<font face='verdana' size='2'>" & "Discipline Praticate:" & "" & rs("DisciplinePraticate") 
    Response.Write "<p align='center'>" & "<font face='verdana'>"
    Response.Write ""& rs("SitoInternet") & ""
    'Response.Write ""& rs("E-Mail") & ""
    Response.Write "<p align='center'>" & "<font face='verdana'>" & rs("Telefono")
    Response.Write "</td>"
    
    ' Seconda cella
    Response.Write  "<td align='center'>"
    Response.Write "[img][/img]"
    Response.Write "</td>"
    Response.Write "</tr>"
    Response.Write "</table>"
                   
    
    
    
    
    
    
    
    
    
    		rs.movenext
    	wend
    	%>
    	<div class="page_navigator">
    	<span class="page_view"><%
    	
    		'*** EDIT *** pagina a cui puntare
    		wbp_basePage = "index.asp"
    		'*** EDIT *** querystring aggiuntiva ( es: "&sort=date" )
    		wbp_baseQuerystring = ""
    		
    		%></span>
    <span class="topic-pages"><%
    		if wbp_totalPages > 1 then
    			%><span class="page_pagesnav"><%=wbp_totalPages%> pagine [ <%
    			if wbp_currentPage > 1 then
    				if wbp_currentPage > 2 then
    					%>&lt;&lt; <%
    				end if
    			%>&lt; <%
    				if wbp_currentPage - 3 > 0 then%><%=wbp_currentPage-3%> <% end if
    				if wbp_currentPage - 2 > 0 then%><%=wbp_currentPage-2%> <% end if
    				if wbp_currentPage - 1 > 0 then%><%=wbp_currentPage-1%> <% end if
    			end if
    			%><%=wbp_currentPage%> <%
    			if wbp_currentPage < wbp_totalPages then
    				if wbp_currentPage + 1 < wbp_totalPages + 1 then%><%=wbp_currentPage+1%> <% end if
    				if wbp_currentPage + 2 < wbp_totalPages + 1 then%><%=wbp_currentPage+2%> <% end if
    				if wbp_currentPage + 3 < wbp_totalPages + 1 then%><%=wbp_currentPage+3%> <% end if
    				%>&gt; <%
    				if wbp_currentPage < wbp_totalPages - 1 then
    					%>&gt;&gt; <% 
    				end if
    			end if
    		%> ]</span><%
    		else
    		%>1 pagina<%
    		end if%>
    	</span>
    	</div><%
    	
    else
    	'*** EDIT *** se il recordset è vuoto...
    	response.write "nessun record"
    	
    end if
    
    
    %>
    ___________________________________
    Non si finisce mai di imparare...

  2. #2
    Forse ci sono quasi.

    Ho fatto la pagina scheda.asp

    Come faccio a impostare nel SELECT from il record da richiamare nella pagina precedente?


    Ecco il code di scheda.asp

    codice:
    <body bgcolor="#d8dfca" text="#333300">
    <%@ Language=VBScript %>
    <% pageTitle = "Pannello Controllo" %>
    
    
    </head>
    
    
    <center>
      <font size="4">Scheda Società</font> 
    </center>
    <left>
    <%    
        set Conn = Server.CreateObject("ADODB.Connection")
        Conn.Open ConString
    %>
    <%
    Dim Conn, rs
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open ConString
    
    Set rs = Conn.Execute("SELECT id, fuoriprovincia, denominazione, associazione, indirizzo, SitoInternet, Telefono, DisciplinePraticate, logo FROM tabella_ricerca WHERE ID="&ID")
    While Not rs.EOF
    
    Response.Write "<hr size='1' color='midnightbluè width='40%'align='center'>"
    Response.Write "<table border='1' cellpadding='0' cellspacing='0' width='700'>"
    Response.Write "<tr><td width='500'>"
    Response.Write "SOCIETA' = " & rs("associazione") & "
    "
    Response.Write "Adsds = " & rs("id") & "
    "
    Response.Write "sdsd = " & rs("id") & "
    "
    Response.Write "Asdsd = " & rs("id") & "
    "
    Response.Write "Isdsds = " & rs("id") & "
    "
    Response.Write "Data = " & rs("id") & "
    "
    'Costruisco la seconda cella per la Thumb
    Response.Write "</td>"
    Response.Write "<td width='200' align='center'>"
    Response.Write "[img][/img]
    "
    
    
    Response.Write "</td></tr>"
    Response.Write "</table>"
    Response.Write "<hr size='1' color='midnightbluè width='40%'align='center'>"
    rs.Movenext
    Wend
    rs.Close
    Set rs = Nothing
    
    Conn.Close
    Set Conn = Nothing
    %>
    </body>
    
    
    </html>
    ___________________________________
    Non si finisce mai di imparare...

  3. #3
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Prima della SELECT:
    codice:
    id = trim(request.querystring("id"))
    Roby

  4. #4
    Così ?

    codice:
    id = trim(request.querystring("id"))
    Set rs = Conn.Execute("SELECT id, fuoriprovincia, denominazione, associazione, indirizzo, SitoInternet, Telefono, DisciplinePraticate, logo FROM tabella_ricerca WHERE ID="&ID")
    While Not rs.EOF
    ___________________________________
    Non si finisce mai di imparare...

  5. #5
    ok, la pagina scheda.asp dovrebbe fungere.

    Ora il link esatto dalla pagina index.asp come lo devo scrivere?

    Mi da il seguente errore di scrittura

    Invalid character

    /societa/index.asp, line 87

    Response.Write rs("denominazione") &" " & "http://" & "<font face=&#39;Verdana&#39; col..." & "</p>" & ""
    ----------------------------------------------------------------------^
    ___________________________________
    Non si finisce mai di imparare...

  6. #6
    Ci siamo quasi, mi serve solo un piccolo aiutino.


    SE utilizzo questo link:

    Mi riporta ovviamente in maniera corretta e senza errori alla pagina scheda.asp relativa all'id 12.
    Come faccio a dargli in automatico il link relativo?
    ___________________________________
    Non si finisce mai di imparare...

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 © 2026 vBulletin Solutions, Inc. All rights reserved.