Pagina 4 di 5 primaprima ... 2 3 4 5 ultimoultimo
Visualizzazione dei risultati da 31 a 40 su 41

Discussione: Problema codice

  1. #31
    Prova così:

    codice:
    <%@ language= VBScript
    
    option explicit
    <% 
    dim sql,conn,rs,x, User, Psw , rs2, sql2 
    
    User = request.Form ("User") 
    Psw = request.form ("Psw") 
    %> 
    <html> 
    <head> 
    <title> Visulizzazione Assenze e ritardi </title> 
    </head> 
    <body> 
    <% 
    set conn=server.createobject("adodb.connection") 
    conn.Provider="Microsoft.Jet.OLEDB.4.0" 
    conn.open(server.mappath("prova.mdb")) 
    
    set rs=Server.CreateObject("ADODB.Recordset") 
    
    sql=" select* from Studenti" 
    rs.open sql,conn 
    
    if rs("User")=User and rs("psw")= psw then 
    	If Not rs.eof then 
    		set rs2 = Server.CreateObject("ADODB.Recordset") 
    		Do while Not rs.eof 
    			sql2 = "select * from Movimenti,Studenti where '" & rs("User") & "' = '" & User & "' and '" & rs("psw") & "' = '" & psw & "'" 
    			rs2.open sql2,conn
    			
    			If Not rs2.eof then
    				Do while Not rs2.eof 			
    %>
    					<table border="3" width="100%"> 
    					<tr> 
    					<% 
    					for each x in rs2.fields 
    					    response.write("<th>"& x.name & "</th>") 
    					next
    					%> 
    					</tr> 
    					<tr> 
    					<%
    					for each x in rs2.fields 
    					    response.write("<td>" & x.value & "</td>") 
    					next 
    					%> 
    					</tr> 
    					</table> 
    <%		
    					rs2.movenext
    				Loop
    			End If
    		Loop 
    		rs2.open sql2,conn 
    		rs2.movenext 
    	end if 
    
    else
    %> 
    	<h4>User o password errati</h4> 
    	Torna alla pagina di login 
    <%
    end if 
    rs.close 
    set rs = nothing 
    conn.close 
    set conn = nothing 
    %> 
    </body> 
    </html>
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

  2. #32
    EDIT:

    Nn riesco a capire perchè tra i 4 utenti di prova che inserisco nel database solo di uno riconosce user e password....mah

  3. #33
    mhmmm....il ciclo dovrei inserirlo prima di

    if rs("User")=User and rs("psw")= psw then

    perchè deve far passare tutti gli studenti...nn dopo...

    riesci ad aggiustare???

    fai pure con calma

    :P

  4. #34
    Ehm... non ho letto tutto il thread, ma innanzitutto direi di sostituire questo:
    codice:
    sql=" select* from Studenti" 
    rs.open sql,conn 
    
    if rs("User")=User and rs("psw")= psw then 
    	If Not rs.eof then
    con questo
    codice:
    sql=" select * from Studenti where User = '" & User & "' and psw = '" & psw & "'"
    rs.open sql,conn 
    	If Not rs.eof then
    EDIT: uhm... col senno di poi, forse avrei fatto meglio a leggere il thread, maledetta pigrizia
    Home: http://www.ivansweb.com
    Le mie applicazioni gratuite in ASP
    · IWGallery
    · IWNewsletter
    · IWMessenger
    · IWGuestbook

  5. #35
    grazie...appena posso provo




    EDIT: che faccio...prendo nota della tua modifica o no???

  6. #36
    Il fatto è che queste parti non le capisco:
    codice:
    User = request.Form ("User") 
    Psw = request.form ("Psw")
    
    ....
    
    sql=" select* from Studenti" 
    rs.open sql,conn 
    
    if rs("User")=User and rs("psw")= psw then 
    	If Not rs.eof then
    non mi sembra che abbia un senso...
    Home: http://www.ivansweb.com
    Le mie applicazioni gratuite in ASP
    · IWGallery
    · IWNewsletter
    · IWMessenger
    · IWGuestbook

  7. #37
    user e psw vengono prese da una pagina precedente

  8. #38
    si, ma immagino che con questa:
    codice:
    sql=" select* from Studenti" 
    rs.open sql,conn 
    
    if rs("User")=User and rs("psw")= psw then 
    	If Not rs.eof then
    tu voglia "filtrare" lo studente in base ai dati che ha immesso nel form precedente, giusto?
    Se è così, quella parte non ha senso, perchè quella query ti restituisce SEMPRE il primo record della lista (se c'è almeno 1 record)

    Prova a sostituire con quello che ti ho postato io
    Home: http://www.ivansweb.com
    Le mie applicazioni gratuite in ASP
    · IWGallery
    · IWNewsletter
    · IWMessenger
    · IWGuestbook

  9. #39
    si si ineffetti quello che stavo facendo nn aveva senso ora vedo di correggere

  10. #40
    La query proposta da ivanhalen:

    codice:
    sql=" select * from Studenti where User = '" & User & "' and psw = '" & psw & "'"
    va bene, per semplificare il codice.
    Provare paura per un qualcosa che ti possa capitare nel futuro non ti evita quell'evento,ti fa soltanto vivere un presente sbagliato!

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.