Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 16
  1. #1
    Utente di HTML.it L'avatar di whois
    Registrato dal
    Jan 2001
    Messaggi
    128

    richiamare "record filtrati" in una pagina asp

    Salve a tutti,
    ho un problema, non so come risolverlo

    nel mio .mdb ho la tabella ARTICLES con le seguenti intestazioni di colonne

    ART_ID
    ART_TYPE
    ART_SUBTYPE
    ART_NAME


    ho una pagina asp, dove in diversi punti devo inserire far comparire "i primi 2 articoli" filtrati per ART_TYPE = (numero) e ART_SUBTYPE (numero)

    esempio

    nel BOX1

    top 2 della tabella ARTICLES ART_TYPE = 1 e ART_SUBTYPE 2

    nel BOX2

    top 2 della tabella ARTICLES ART_TYPE = 4 e ART_SUBTYPE 5


    e così via....

    Non saprei proprio da dove cominciare....
    mi date una mano per favore?

    GRAZIE

  2. #2
    SELECT TOP 2 * FROM WHERE ART_TYPE = 1 OR ART_TYPE = 2
    SELECT TOP 2 * FROM WHERE ART_TYPE = 4 OR ART_TYPE = 5
    Per ogni query crei un recordset, esegui la query e fai un ciclo di massimo 2 giri.

  3. #3
    Utente di HTML.it L'avatar di whois
    Registrato dal
    Jan 2001
    Messaggi
    128
    PER PRIMA COSA GRAZIE...

    <%

    Dim Conn

    Set Conn = Server.CreateObject("ADODB.Connection")

    conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("MDB-DATABASE/DUARTICLE.mdb")
    Dim rs1

    Set rs1 = Server.CreateObject("ADODB.Recordset")
    rs1.Open "select TOP 2 * from ARTICLES WHERE ART_TYPE = 1 AND ART_SUBTYPE = 2 order by id DESC", conn
    Do while NOT RS.EOF


    Set rs2 = Server.CreateObject("ADODB.Recordset")
    rs2.Open "select TOP 2 * from ARTICLES WHERE ART_TYPE = 1 AND ART_SUBTYPE = 2 order by id DESC", conn
    Do while NOT RS.EOF

    Set rs3 = Server.CreateObject("ADODB.Recordset")
    rs3.Open "select TOP 2 * from ARTICLES WHERE ART_TYPE = 1 AND ART_SUBTYPE = 2 order by id DESC", conn
    Do while NOT RS.EOF


    %>


    CONTENUTO BOX1

    <%

    Dim ART_NAME

    ART_NAME=rs1("ART_NAME")

    response.write(ART_NAME)

    %>

    CONTENUTO BOX2

    <%

    Dim ART_NAME

    ART_NAME=rs2("ART_NAME")

    response.write(ART_NAME)

    %>

    CONTENUTO BOX3

    <%

    Dim ART_NAME

    ART_NAME=rs3("ART_NAME")

    response.write(ART_NAME)

    %>
    GIUSTO?

  4. #4
    Sti box devono essere annidati?

  5. #5
    Utente di HTML.it L'avatar di whois
    Registrato dal
    Jan 2001
    Messaggi
    128
    No, vanno posizionati ciascuno in una cella di una tabella

  6. #6
    codice:
    <%
    
    Dim Conn
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    
    conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("MDB-DATABASE/DUARTICLE.mdb")
    Dim rs1, ART_NAME
    
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    
    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 1 AND ART_SUBTYPE = 2 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    NEXT
    response.write "</div>"
    END IF
    rs1.close
    
    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 4 AND ART_SUBTYPE = 5 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    NEXT
    response.write "</div>"
    END IF
    rs1.clos4
    
    set rs1 = nothing
    
    conn.close
    set conn = nothing
    %>

  7. #7
    Utente di HTML.it L'avatar di whois
    Registrato dal
    Jan 2001
    Messaggi
    128
    non va..impossibile visualizzare la pagina
    ho provveduto a cambiare ART_TYPE e ART_SUBTYPE con numeri esistenti nel db...sbaglio ancora qualcosa?



    <%

    Dim Conn

    Set Conn = Server.CreateObject("ADODB.Connection")

    conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("MDB-DATABASE/DUARTICLE.mdb")
    Dim rs1, ART_NAME

    Set rs1 = Server.CreateObject("ADODB.Recordset")

    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 28 AND ART_SUBTYPE = 72 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    NEXT
    response.write "</div>"
    END IF
    rs1.close

    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 28 AND ART_SUBTYPE = 44 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    NEXT
    response.write "</div>"
    END IF
    rs1.close

    set rs1 = nothing

    conn.close
    set conn = nothing
    %>

  8. #8
    Dalle opzioni avanzate di explorer TOGLI la spunta dalla voce Mostra Messaggi di Errore HTTP brevi.

  9. #9
    Utente di HTML.it L'avatar di whois
    Registrato dal
    Jan 2001
    Messaggi
    128
    Microsoft VBScript compilation error '800a041f'

    Unexpected 'Next'

    /topdu.asp, line 21

    NEXT
    ^

  10. #10
    codice:
    <%
    
    Dim Conn
    
    Set Conn = Server.CreateObject("ADODB.Connection")
    
    conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("MDB-DATABASE/DUARTICLE.mdb")
    Dim rs1, ART_NAME
    
    Set rs1 = Server.CreateObject("ADODB.Recordset")
    
    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 1 AND ART_SUBTYPE = 2 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    END IF
    NEXT
    response.write "</div>"
    END IF
    rs1.close
    
    rs1.Open "select TOP 2 ART_NAME from ARTICLES WHERE ART_TYPE = 4 AND ART_SUBTYPE = 5 order by id DESC", conn
    IF not RS.EOF THEN
    response.write "<div>"
    FOR i = 1 to 2
    IF NOT RS.EOF THEN
    ART_NAME=rs1("ART_NAME")
    response.write(ART_NAME) & "
    "
    RS.moveNext
    END IF
    NEXT
    response.write "</div>"
    END IF
    rs1.clos4
    
    set rs1 = nothing
    
    conn.close
    set conn = nothing
    %>

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.