Sovrapposizioni dati clienti loggati . Aiuto !!!

martedì 21 novembre 2006 - 19.42

borisgiulivi Profilo | Newbie

Nel nostro database si verifica molto spesso che una prenotazione effettuata da un nuovo utente viene attribuita all'utente precedente !!!! Penso che sia un problema dello script , infatti riceviamo la mail corretta del nuovo utente via posta elettronica ma nel database la prenotazione vine attribuita al vecchio utente !!!
Riporto lo script...
<%

' +++ UPDATE CLIENT +++
'se l'utente è loggato recupero i dati e modifico i dati vecchi con i nuovi inserimenti
NEW_CLIENT_ID=""

'Response.Write("NEW_CLIENT="&NEW_CLIENT)
if NEW_CLIENT=false then
SqlText = "EXECUTE SP_UPDATE_CLIENT "&IdUtente&",'"&_
UserName&"', '"&Password&"','"&Cognome&"','"&Nome&"',"&_
"'"&Address&"','"&Phone&"','"&MobilePhone&"','"&Fax&"','"&Date_birth&"',"&_
"'"&Place_birth&"','"&Passport_number&"'"
'------------------------------------------------------------------------------
Set conn = Server.CreateObject("ADODB.Connection")
'Response.Write(SqlText)
On error resume next
conn.Open ConnettiDatabase
conn.Execute SqlText
if err.Number<>0 then
%>
<tr><td> </td></tr>
<tr><td> <b>Updating client error:</b><%=err.description%></td></tr><br>
<tr><td> <a style="color:darkblue" href="javascript:history.back()">Back</a></td></tr>
<%Response.end
else
' --- getting of client code ---
NEW_CLIENT_ID=Session("IdClient")
end if
On error goto 0
Set conn=Nothing
else
'altrimenti viene generato un nuovo utente con i dati della pagina precedente
' +++ NEW CLIENT +++
SqlText = "DECLARE @ID_NEW_CLIENT nvarchar(10) EXECUTE SP_ADD_NEW_CLIENT '"&_
UserName&"', '"&Password&"','"&Cognome&"','"&Nome&"',"&_
"'"&Address&"','"&Phone&"','"&MobilePhone&"','"&Fax&"','"&Date_birth&"',"&_
"'"&Place_birth&"','"&Passport_number&"',"&_
" @ID_NEW_CLIENT OUTPUT SELECT @ID_NEW_CLIENT AS new_client_id"
'------------------------------------------------------------------
Set conn = Server.CreateObject("ADODB.Connection")
Set RsInsert = Server.CreateObject("ADODB.RecordSet")
On error resume next
conn.Open ConnettiDatabase
conn.Execute SqlText
'Response.Write(SqlText)
if err.Number<>0 then
%>
<tr><td> </td></tr>
<tr><td> <b>Creating new client error:</b><%=err.description%></td></tr><br>
<tr><td> <a style="color:darkblue" href="javascript:history.back()">Back</a></td></tr>
<%Response.end
else
SqlText = "SELECT MAX(cod_cliente) AS ND FROM Dati_cliente"
RsInsert.open SqlText, ConnettiDatabase, 3, 1
if not RsInsert.EOF then
NEW_CLIENT_ID=RsInsert("ND")
end if
SqlText = "SELECT MAX(IdUtente) AS ID_UT FROM Utenti"
RsInsert.open SqlText, ConnettiDatabase, 3, 1
if not RsInsert.EOF then
NEW_UTENTE_ID=RsInsert("ID_UT")
end if
'--------------------------------
Session("IdUtente")=NEW_UTENTE_ID
Session("UserName")=UserName
Session("IdClient")=NEW_CLIENT_ID
'--------------------------------
end if
On error goto 0
Set RsInsert=Nothing
Set conn=Nothing
'
'functions will throw an exception if the operation is unsuccessful, so on error resume next is used
On Error Resume Next
Set objEmail = Server.CreateObject("Dundas.Mailer")
objEmail.FromAddress = EMAIL_INFO
objEmail.Subject = "RSH - Creazione Nuovo Utente"
objEmail.CCs.Add EMAIL_UTENTE
if not DEBUG then
objEmail.SMTPRelayServers.Add maddress, mport, , muser, mpassword
end if
objEmail.HTMLBody = "<Html><Head></Head>"
'------initialize html body of message-----
objEmail.HTMLBody = objEmail.HTMLBody & "<body>"
strTemp = bodynewuser
strTemp = Replace(strTemp,"<br>","<br>")
if (DEBUG) then response.Write(strTemp)
objEmail.HTMLBody = objEmail.HTMLBody & strTemp
objEmail.HTMLBody = objEmail.HTMLBody & "</body></html>"
'--------------------------------------------
'send the email
objEmail.SendMail
'test for success/failure
If Err.Number <> 0 Then
response.write "<tr><td> <b>Email sending error:</b>"&Err.Description&"</td></tr>"
Set objEmail = Nothing
Else
Set objEmail = nothing
%>
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5