Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Errore Paginazione

  1. #1

    Paginazione, oridine per un campo. come?

    Cosa c'è di sbagliato in questo codice?
    <%@LANGUAGE = JScript%>
    <%
    var Cn = new ActiveXObject("ADODB.Connection");
    var Sc = "driver={Microsoft Access Driver (*.mdb)};dbq=" + Server.MapPath("/mdb-database/Libri.mdb");
    Cn.Open(Sc);
    var Sql = "SELECT * FROM libri";
    var Mostra = new ActiveXObject("ADODB.Recordset");
    Mostra.Open(Sql,Cn,1);
    var pag = parseInt(Request.QueryString("id"));
    if (isNaN(pag) || pag < 1) pag = 1;
    if (!Mostra.EOF) {
    Mostra.PageSize = 5;
    Mostra.AbsolutePage = pag;
    }
    var i = 0;
    %>
    <html>
    <head>
    <title>Paginazione</title>
    </head>
    <body>

    <%while (!Mostra.EOF && i<5) {%>
    <table width="100%" border="1">
    <tr>
    <td><%=Mostra("Autori")%></td>
    </tr>
    </table>

    <%
    i++;
    Mostra.MoveNext();
    }
    %>


    <table width="100%">
    <tr>
    <td width="50%">
    <%if (pag > 1) {%>Precedenti<%}%>
    <%else {%>Precedenti<%}%>
    </td>
    <td width="50%" align="right">
    <%if (!Mostra.EOF) {%>Successivi<%}%>
    <%else {%>Successivi<%}%>
    </td>
    </tr>
    </table>

    </body>
    </html>
    <%Cn.Close()%>

    In base a questo codice come posso mettere in ordine i risultati in base ad un campo e non in base all'id

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Lo devi passare nel link e poi recuperarlo e metterlo nella query.

    Roby

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.