Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 15

Discussione: pagina con errore

  1. #1

    pagina con errore

    Ciao a tutti,

    Ho un problema con questa pagina, non riesco a capire dove sbaglio...
    In pratica la pagina deve tirarmi su i record collegati ai due campi del form....



    <%
    ' Get Search Phrase
    user_id = TRIM( Request( "user_id" ) )
    password = TRIM( Request( "password" ) )

    ' Open Database Connection
    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "Select"
    %>
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form method = "post" action="autenticazione.asp" >
    <input name = "user_id" size="30">
    <input name="password" size="30">
    <input type="submit" value="Search">
    </form>




    <%
    sqlstring = "select * from User where user_id = 'user_id' AND password = 'password' "
    SET RS = Con.execute( sqlstring )
    IF NOT RS.EOF AND user_id <> "" AND password <> "" THEN
    %>
    </p>
    <table width="200" border="1">
    <tr>
    <th scope="col">Utente</th>
    <th scope="col">Pool</th>
    <th scope="col">Fascia</th>
    </tr>
    <%
    WHILE NOT RS.EOF
    %>
    <tr>
    <td><%=RS( "Nome Utente" ) %></td>
    <td><%=RS( "Pool" ) %></td>
    <td><%=RS( "Fascia" ) %></td>
    </tr>
    <%
    rs.movenext
    wend
    %>
    </table>
    <%
    else
    %>


    Nessun Risultato Trovato</p>
    <%
    END IF
    %>



    </body>
    </html>
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  2. #2
    devi scrivere ke errore ti da...

  3. #3
    praticamente quando inserisco nel form i dati questo non mi tira su niente, non mi da errore, la pagina rimane sempre con la scritta:

    Nessun Risultato Trovato

    come è giusto che esce se i campi del form sono vuoti...
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  4. #4
    allora,
    ho sistemato un pò il codice....

    <%
    ' Get Search Phrase
    user_id = TRIM( Request( "user_id" ) )
    password = TRIM( Request( "password" ) )

    ' Open Database Connection
    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "Select"
    %>
    <html>
    <head>
    <title>Documento senza titolo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form method = "post" action="autenticazione.asp" >
    <input name = "user_id" size="30">
    <input name="password" size="30">
    <input type="submit" value="Search">
    </form>



    <%
    sqlstring = "select * from User where user_id LIKE '%" & user_id & "%' AND password LIKE '%" & password & "%' "
    SET RS = Con.execute( sqlstring )
    IF NOT RS.EOF AND user_id <> "" AND password <> "" THEN
    %>
    </p>
    <table width="200" border="1">
    <tr>
    <th scope="col">Utente</th>
    <th scope="col">Pool</th>
    <th scope="col">Fascia</th>
    </tr>
    <%
    WHILE NOT RS.EOF
    %>
    <tr>
    <td><%=RS( "Nome Utente" ) %></td>
    <td><%=RS( "Pool" ) %></td>
    <td><%=RS( "Level" ) %></td>
    </tr>
    <%
    rs.movenext
    wend
    %>
    </table>
    <%
    else
    %>


    Nessun Risultato Trovato</p>
    <%
    END IF
    %>


    </body>
    </html>


    ora però mi da il seguente errore:

    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][Driver ODBC Microsoft Access] Impossibile usare "(sconosciuto)". File già in uso.
    /select/autenticazione.asp, line 9


    cosa potrebbe essere??? alla fine io la connessione l'ho aperta una sola volta...
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  5. #5

    nessun suggerimento???
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  6. #6
    Fossi in te non chiamerei il nome di un campo del database access "password" perchè è una parola riservata. Sostituiscila con "Psw"!
    Poi nelle select scriverei:
    sqlstring = "select * from User where user_id = '" & user_id & "' AND Psw = '" & password & "' "

    Inoltre la condizione

    IF NOT RS.EOF AND user_id <> "" AND password <> "" THEN

    la scriverei all'interno del ciclo "WHILE" così effettua il controllo ogni movenext.
    Ciao
    Non dire gatto se non ce l'hai nel sacco! ATTIA!

  7. #7
    Ciao Ragazzi,
    Adesso il problema è sulla riga 23...
    mi dice che non c'è specificato nessun oggetto ma io lo specifico...

    La riga è questa: rs.Execute (sqlstring)
    vi posto sotto anche il codice...

    Grazie per l'aiuto...



    <%
    user_id = TRIM( Request( "user_id" ) )
    password = TRIM( Request( "password" ) )

    Set Con = Server.CreateObject( "ADODB.Connection" )
    Con.Open "Listino"
    %>
    <html>
    <head>
    <title>Autenticazione Utente</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>
    <form method = "post" action="autenticazione.asp" >
    <input name = "user_id" size="30">
    <input name="password" size="30">
    <input type="submit" value="Search">
    </form>



    <%
    sqlstring = "select * from User where user_id LIKE '%" & user_id & "%' AND password LIKE '%" & password & "%' "
    rs.Execute (sqlstring)
    IF NOT rs.EOF AND user_id <> "" AND password <> "" THEN
    %>
    </p>
    <table width="200" border="1">
    <tr>
    <th scope="col">Utente</th>
    <th scope="col">Pool</th>
    <th scope="col">Fascia</th>
    </tr>
    <%
    WHILE NOT rs.EOF
    %>
    <tr>
    <td><%=rs( "Nome Utente" ) %></td>
    <td><%=rs( "Pool" ) %></td>
    <td><%=rs( "Level" ) %></td>
    </tr>
    <%
    rs.MoveNext
    wend
    %>
    </table>
    <%
    else
    %>


    Nessun Risultato Trovato</p>
    <%
    end if
    %>


    </body>
    </html>
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  8. #8
    la sintassi corretta è:

    set rs = con.execute(sqlstring)

    ricordati di fare le correzioni che ti ho detto prima....
    Non dire gatto se non ce l'hai nel sacco! ATTIA!

  9. #9
    OK ora funziona...
    Scusa ma non capisco come inserirlo nel ciclo while...
    sai sono un novizio con l'asp...mi potresti spiegare velocemente, non capisco se devo crearne un altro di ciclo while oltre a quello che ho usato io o se lo devo integrare...

    il ciclo while dovrebbe funzionare così giusto:

    while condizione

    istruzione

    wend

    giusto???
    :metallica
    Che cosa vuoi che ti dica???
    Senti che bel rumore...

  10. #10
    Questo dovrebbe essere il codice corretto.


    ===============================
    </p>
    <table width="200" border="1">
    <tr>
    <th scope="col">Utente</th>
    <th scope="col">Pool</th>
    <th scope="col">Fascia</th>
    </tr>
    <%
    WHILE NOT rs.EOF
    IF NOT rs.EOF AND user_id <> "" AND password <> "" THEN %>
    <tr>
    <td><%=rs( "Nome Utente" ) %></td>
    <td><%=rs( "Pool" ) %></td>
    <td><%=rs( "Level" ) %></td>
    </tr>

    <%
    else
    %>


    Nessun Risultato Trovato</p>
    <%

    end if
    rs.MoveNext
    wend
    %>
    </table>
    Non dire gatto se non ce l'hai nel sacco! ATTIA!

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