Pagina 1 di 5 1 2 3 ... ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 42

Discussione: ordinamento lista

  1. #1

    ordinamento lista

    ciao a tutti, ho creato la pagina (trovato.asp) che fa lista elaborata dall'altra pagina di ricerca (trova.asp). Funzionava bene e quando ho inserito la divisione delle pagine per evitare chilometriche lista e non mi funziona bene, potete dare un'occhiata?

    -----------------------------------------------------------------
    <style type="text/css">
    <!--
    body {
    background-color: #003366;
    }
    body,td,th {
    color: #FFFFFF;
    }
    a:link {
    color: #FF0000;
    }
    a:visited {
    color: #FF9966;
    }
    a:hover {
    color: #FF9966;
    }
    a:active {
    color: #FF0000;
    }
    -->
    </style><%
    Function JSRedirect(Byval url, secondi)
    With Response
    .Write("<script language=""JavaScript"">" & vbCrLf)
    .Write("<!--" & vbCrLf)
    .Write("function redirect() {" & vbCrLf)
    .Write("window.location = '" & url & "';" & vbCrLf)
    .Write("}" & vbCrLf)
    .Write("timer = setTimeout('redirect()', '" & (secondi * 1000) & "');" & vbCrLf)
    .Write("-->" & vbCrLf)
    .Write("</script>" & vbCrLf)
    End With
    End Function


    Dim Cerca
    Cerca = Replace(Request.Form("search1"), "'", "")


    iPageSize = 40 'NUMERO RECORD PER PAGINA

    If Request.QueryString("page") = "" Then
    iPageCurrent = 1
    Else
    iPageCurrent = CInt(Request.QueryString("page"))
    End If



    Dim Conn
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.open "dsn=gestionbadget;uid=XXXX;pwd=XXX;"
    Conn.Open adOpenStatic, adLockReadOnly, adCmdText

    reccount = RS.recordcount
    iPageCount = RS.PageCount

    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    If iPageCurrent < 1 Then iPageCurrent = 1

    dim check
    check=Request.Form("radio1")

    if check = 1 then
    chiave = "dbo.arch_assegn"
    url = "visualizza.asp?ID="
    tab = "ID"
    ord = "data_rit"
    text = "Data Consegnato"
    data = "data_rit"
    elseif check = 2 then
    chiave = "dbo.assegnatario"
    url = "trovato.asp?num_badge="
    tab ="num_badge"
    ord ="num_badge"
    text = "Data Assegnato"
    data = "data_cons"
    end if


    Dim strSQL, Rs
    if request.form("num")<>"" then
    dim num
    num=Request.Form("num")
    if num = 1 then
    numero = "num_badge"
    elseif num = 2 then
    numero = "matricola"
    end if

    strSQL = "Select * from "& chiave &" where "& numero &" like '%" & Cerca & "%' order by "& ord &" desc"
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open strSQL, Conn, 3, 3

    else

    strSQL = "Select * from "& chiave &" where nome like '%" & Cerca & "%' or cognome like '%" & Cerca & "%' order by "& ord &" desc"
    Set Rs = Server.CreateObject("ADODB.Recordset")
    Rs.Open strSQL, Conn, 3, 3
    end if

    if Rs.EOF then
    Response.Write "

    <table><td><font face='verdana' size='2' color='#FFFFFF'>Nessun risultato trovato.</td></table></p>"
    call JSRedirect("trova.asp",2)
    else
    Rs.AbsolutePage = iPageCurrent
    iRecordsShown = 0
    %>
    <table cellpadding="0" align="center" cellspacing="0" border="0" width="60%">
    <tr>
    <td bgcolor="#cccccc">
    <table cellpadding="2" cellspacing="1" border="0" width="100%">
    <tr height="22">

    <td bgcolor="#dddddd" WIDTH="4%"><font face="verdana" size="2" color="#000000">N. Badge</font></td>
    <td bgcolor="#dddddd" WIDTH="4%"><font face="verdana" size="2" color="#000000">Matricola</font></td>
    <td bgcolor="#dddddd" WIDTH="6%"><font face="verdana" size="2" color="#000000">Nome</font></td>
    <td bgcolor="#dddddd" WIDTH="6%" align="center"><font face="verdana" size="2" color="#000000">Cognome</font></td>
    <td bgcolor="#dddddd" WIDTH="5%" align="center"><font face="verdana" size="2" color="#000000">Tipologia</font></td>
    <td bgcolor="#dddddd" WIDTH="9%" align="center"><font face="verdana" size="2" color="#000000"><% Response.write(""& text &"")%></font></td>
    </tr>
    <%
    cont=1
    Do While iRecordsShown < iPageSize And Not RS.EOF


    Dim Riga, bg
    Riga = Riga + 1
    If Riga Mod 2 = 0 then
    bg = "#E4E4E4"
    txcol = "#000000"
    Else
    bg = "#ccccff"
    txcol = "#FFFF00"
    End if
    Response.write "<tr bgcolor = " & bg & "><td><font color="& txcol &" size='4'>" & (iPageSize*iPageCurrent)-iPageSize+Cont & "</font></td>"
    Response.write "<td><font color='#FFFF00' size ='4'>" & Rs("num_badge") & "</font></td>"
    Response.write "<td><font color='#FF0000' size='4'>"
    if Rs("Matricola").Value = "0" then
    response.write "Nessuna"
    else
    response.write "" & Rs("Matricola") &""
    end if
    response.write "</font></td>"
    Response.write "<td><font color='#FF0000' size='4'>" & Rs("nome") & "</font></td>"
    Response.write "<td><font color='#FF0000' size='4'>" & Rs("Cognome") & "</font></td>"
    Response.write "<td><center><font color='#FF0000' size='4'>"

    if Rs("tipologia").Value = "1" then
    response.write "Dipendente"
    end if

    if Rs("tipologia").Value = "2" then
    response.write "Consulente"
    end if

    if Rs("tipologia").Value = "3" then
    response.write "Fornitore"
    end if

    if Rs("tipologia").Value = "4" then
    response.write "Cliente"
    end if

    response.write "</font></center></td>"
    Response.write "<td><center><font color='#FF0000' size='4'>" & Rs (""& data &"") &"</font></center></td></tr>"

    Cont = Cont + 1
    'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB
    iRecordsShown = iRecordsShown + 1
    RS.MoveNext
    Loop
    End If
    response.write "
    "
    Response.write "<font color='#FF0000' size='4'>[B]Riavvia la ricerca</font>"
    response.write "
    "
    Rs.close
    Set Rs = Nothing

    <%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 Conn = Nothing
    %>
    --------------------------------------------------------------------

    Grazie
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  2. #2
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    Cosa non funziona?
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  3. #3
    non funziona e appare questo errore:

    -----------------------------------------------------------
    Tipo di errore:
    Errore di compilazione di Microsoft VBScript (0x800A0400)
    Prevista istruzione
    /gestionebadget/search.asp, line 183
    <%If ipagecount <> 1 Then
    -------------------------------------------------------------

    Stavo tentando di dividere la lista, non ci riesco...
    Gabry
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  4. #4
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    devi togliere <% perchè il tag asp era già aperto...

    If ipagecount <> 1 Then %>
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  5. #5
    ecco altro errore

    -----------------
    Tipo di errore:
    ADODB.Connection (0x800A0E79)
    Operation is not allowed when the object is open.
    /gestionebadget/search.asp, line 56
    --------------------------------
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  6. #6
    la riga era

    Conn.Open strSQL, adOpenStatic, adLockReadOnly, adCmdText
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  7. #7
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    se vedi apri la connessione due volte:

    codice:
    Dim Conn 
    Set Conn = Server.CreateObject("ADODB.Connection") 
    Conn.open "dsn=gestionbadget;uid=XXXX;pwd=XXX;" 
    Conn.Open adOpenStatic, adLockReadOnly, adCmdText
    cancella (o commenta) quella in neretto
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  8. #8
    è strano che bisogna toglierlo.... perchè questo fa parte per adovbs.inc.....
    Comunque l'ho tolto e appare questo errore

    Tipo di errore:
    Errore di run-time di Microsoft VBScript (0x800A01A8)
    Necessario oggetto: ''
    /gestionebadget/search.asp, line 58


    la riga era questa:

    reccount = Rs.recordcount
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

  9. #9
    Moderatore di CMS L'avatar di kalosjo
    Registrato dal
    Jul 2001
    residenza
    In culo alla luna
    Messaggi
    1,999
    devi spostare questo
    codice:
    reccount = RS.recordcount 
    iPageCount = RS.PageCount 
    
    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount 
    If iPageCurrent < 1 Then iPageCurrent = 1
    dopo questo

    codice:
    if Rs.EOF then 
      Response.Write "
    
    <table><td><font face='verdana' size='2' color='#FFFFFF'>Nessun risultato trovato.</td></table></p>" 
      call JSRedirect("trova.asp",2) 
    else 
      rs.pagesize=iPagesize
    Scusate i puntini di sospensione...... La verità è che non ho argomenti....

  10. #10
    Ha funzionato la lista dividento 40 righe, ma quando ho cliccato la seconda pagina e appare questo errore:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'where'.
    /gestionebadget/search.asp, line 101


    la riga era
    Rs.Open strSQL, Conn, 3, 3
    ..:: GSFLASH ::..
    HTTP://WWW.GSFLASH.IT
    MCTS - ACP - OCP - ECDL
    Ubuntu 7.10/OpenSuse 10.3/Vista Premium/MacOSX Leopard
    My authentic japanese name is 薗田Sonoda (garden field) 大河 Taiga (big river)

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.