Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118

    Due istruzioni sql su una connessione....problemi...

    Scusate che ci trovate di strano?:
    codice:
    strconn="Driver={Microsoft Access Driver (*.mdb)}; dbq="&Server.MapPath("net.mdb")
    set Conn=Server.CreateObject("ADODB.Connection")
    Conn.open strconn
    Squery="SELECT * FROM notifica where password='"&passp&"' and user='"&utentegal&"'"
    set rs=server.createobject("adodb.recordset")
    rs.open Squery,Conn
    if not rs.eof then
    session("utentegal")=Request.Form("utentegal")
    session("mette")=rs("log")
    session("associa")=rs("ass")
    session("farm")=rs("fa")
    session("reparto")=rs("pre")
    session("unity")=rs("unity")
    session("xcucina")=rs("xcuc")
    'prova del 30--07-2004
    Session("utente") = lcase(trim(Request.form("Utentegal"))) 
    if InStr(1, Application("Users"), Session("utente") & "|" ) = 0 then
    Application.Lock
    Application("Users") = Application("Users") & Session("utente") & "|"
    Application.UnLock
    end if 
    
    Sintra="Insert into statistiche (utente) values ( '"&utentegal"')"
    OBJconn.execute(sintra) 
    Response.Redirect ("guida.asp")
    Else
    Response.Redirect ("riprova.htm")
    End If
    Set rs=Nothing
    conn.close
    set.Conn=Nothing
    Mi dice prevista fine istruzione.......

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    Sintra="Insert into statistiche (utente) values ( '"&utentegal"')"
    response.write (Sintra):response.end 
    OBJconn.execute(sintra)
    Cosa ti stampa?
    In ogni caso la connessione devi chiuderla prima di fare i redirect.

    Roby

  3. #3
    Utente di HTML.it L'avatar di rinzi
    Registrato dal
    May 2004
    Messaggi
    1,444
    manca una & alla concatenazione del paramestro

    così


    Sintra="Insert into statistiche (utente) values ('" & utentegal & "')"

  4. #4
    codice:
    strconn="Driver={Microsoft Access Driver (*.mdb)}; dbq="&Server.MapPath("net.mdb")
    set Conn=Server.CreateObject("ADODB.Connection")
    Conn.open strconn
    Squery="SELECT * FROM notifica where password='"&passp&"' and user='"&utentegal&"'"
    set rs=server.createobject("adodb.recordset")
    rs.open Squery,Conn
    if not rs.eof then
    	session("utentegal")=Request.Form("utentegal")
    	session("mette")=rs("log")
    	session("associa")=rs("ass")
    	session("farm")=rs("fa")
    	session("reparto")=rs("pre")
    	session("unity")=rs("unity")
    	session("xcucina")=rs("xcuc")
    	'prova del 30--07-2004
    	Session("utente") = lcase(trim(Request.form("Utentegal"))) 
    	if InStr(1, Application("Users"), Session("utente") & "|" ) = 0 then
    		Application.Lock
    			Application("Users") = Application("Users") & Session("utente") & "|"
    		Application.UnLock
    	end if 
    	
    	Sintra="Insert into statistiche (utente) values ( '"&utentegal&"')" 'qui mancava la e commerciale!!!!
    	'OBJconn.execute(sintra) 'cos'è objconn se la tua connessione si chiama conn?
    	conn.execute(sintra)
    	Response.Redirect ("guida.asp")
    Else
    	Response.Redirect ("riprova.htm")
    End If
    
    Set rs=Nothing
    conn.close
    set Conn=Nothing'qui avevi sbagliato
    se non è bello ciò che è bello figuriamoci ciò che è brutto!!



    fai anche tu come me: indenta il codice!!!!

  5. #5
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118
    Adesso mi dice che è necessario l'oggetto: OBJConn.Execute("sintra")

  6. #6
    leggi ciò che ti ho scritto!!!!
    se non è bello ciò che è bello figuriamoci ciò che è brutto!!



    fai anche tu come me: indenta il codice!!!!

  7. #7
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118
    Si, vargard ho letto dopo. Grazie mille adesso funziona. Sono perplesso però su quando chiudere la connessione. In effetti va prima del redirect solo che la stessa redirect è all'interno di un IF....

  8. #8
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    codice:
    ...
    ...
    ...if not rs.eof then
    	session("utentegal")=Request.Form("utentegal")
    	session("mette")=rs("log")
    	session("associa")=rs("ass")
    	session("farm")=rs("fa")
    	session("reparto")=rs("pre")
    	session("unity")=rs("unity")
    	session("xcucina")=rs("xcuc")
    	'prova del 30--07-2004
    	Session("utente") = lcase(trim(Request.form("Utentegal"))) 
    	if InStr(1, Application("Users"), Session("utente") & "|" ) = 0 then
    		Application.Lock
    			Application("Users") = Application("Users") & Session("utente") & "|"
    		Application.UnLock
    	end if 
    	
    	Sintra="Insert into statistiche (utente) values ( '"&utentegal&"')" 'qui mancava la e commerciale!!!!
    	'OBJconn.execute(sintra) 'cos'è objconn se la tua connessione si chiama conn?
    	conn.execute(sintra)
    var_red="guida"	
    End If
    
    Set rs=Nothing
    conn.close
    set Conn=Nothing
    
    if var_red="guida" then
    Response.Redirect ("guida.asp")
    else
    Response.Redirect ("riprova.htm")
    end if
    Roby

  9. #9
    guarda roby ...
    se non è bello ciò che è bello figuriamoci ciò che è brutto!!



    fai anche tu come me: indenta il codice!!!!

  10. #10
    Utente di HTML.it L'avatar di diegoctn
    Registrato dal
    May 2001
    Messaggi
    2,118
    Roby mi da :
    Riferimento non valido o non qualificato

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