Visualizzazione dei risultati da 1 a 6 su 6

Discussione: conta click

  1. #1

    conta click

    Salve a tutti ho il seguente problema

    Ho un elenco di record estratti da un db e ho fatto un conta click
    Ogni volta che un record viene visto il campo visite incrementa di uno
    Fino qui tutto bene
    Il problema nasce quando devo andare nella pagina del dettaglio articolo passando per la pagina che mi conta il click

    code
    <%
    ' PERCORSO DEL DATABASE
    c_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/cocktail.mdb")

    Set Conn = Server.CreateObject("ADODB.Connection")
    conn.Open c_DB

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

    ' PRELEVA L'id PASSATO DALLA QUERYSTRING "id"

    id = Replace(Request.QueryString("id") , "'", "''")



    IF id <> "" then

    SQL = "SELECT * FROM COC WHERE id = " & id &""
    RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic



    If RecSet.Eof = False Then

    ' L'id E' PRESENTE
    ' DEVE QUINDI AGGIORNARE SOLO I CLICK

    click_attuali = RecSet("visite")

    ' AGGIORNA I CLICK NEL DB
    RecSet("visite") = click_attuali + 1


    End IF

    ' AGGIORNA IL DB E CHIUDE LA CONNESSIONE
    RecSet.Update
    RecSet.Close
    End IF

    Conn.Close

    IF id <> "" then

    ' PORTA L'UTENTE NEL SITO O NELLA PAGINA DELL'URL
    Response.Redirect "dett_cocktail1.asp?id=RecSet("id")"



    End IF
    %>


    Il problena è nella riga Response.Redirect "dett_cocktail1.asp?id=RecSet("id")" e mi da questo errore

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /cocktail/vai_click.asp, line 47

    Response.Redirect "dett_cocktail1.asp?id=RecSet("id")"

    grazie
    giro

  2. #2
    E' sbagliata così:
    Response.Redirect "dett_cocktail1.asp?id=RecSet("id")"

    Prova questo:
    Response.Redirect "dett_cocktail1.asp?id=" & RecSet("id")

  3. #3
    Adesso mi da il seguente errore

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal.

    /cocktail/vai_click.asp, line 47
    giro

  4. #4
    Sì perché hai chiuso il recordset. Scusami l'ho visto dopo. Prova questo:


    Response.Redirect "dett_cocktail1.asp?id=" & id

  5. #5
    Originariamente inviato da Giro12
    Adesso mi da il seguente errore

    ADODB.Recordset error '800a0cc1'

    Item cannot be found in the collection corresponding to the requested name or ordinal.

    /cocktail/vai_click.asp, line 47
    L'errore indica che nella select non hai incluso il campo che cerchi di richiamare da recordset.

  6. #6
    grazie dell'aiuto funziona
    giro

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.