Rs.Update non Updeizza :(

di il
1 risposte

Rs.Update non Updeizza :(

Ciao ragazzi vi invio il codice perchè sto impazzendo se potete aiutarmi vi ringrazio moltissimo!!


<% @Language=VBScript %>
<% Option explicit %>

<html>
<body bgcolor="#CCCCCC" link="#0000FF" vlink="#0000FF" alink="#0000FF">


<!-- #include virtual="adovbs.inc"-->
<%
'INIZIALIZAZZIONE SCRIPT


'#####################################################################################################################
'AREA DICHIARATIVA

Dim Cn, Rs, User, Pwd, Pwd2, Ind, Scelta1, Scelta2, Scelta3, Tel, Email, Cliente, Sesso, StrSQL
Dim Prov, Comune, Denom, Ragsoc, Cognome, Nome, Cap, Soci, Profes, Idcliente, Piva, Stud, Azienda


'#####################################################################################################################
'APERTURA CONNESSIONI

Set Cn = Server.CreateObject("ADODB.Connection")
Cn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="&Server.MapPath("myDatabase.mdb")

If Cn.State = 1 Then Cn.Close
Cn.Open


'#####################################################################################################################
'CARICAMENTO CAMPI OBBLIGATORI

User = Request ("txt_user")
Pwd = Request("txt_pwd")
Pwd2 = Request("txt_pwdconf")
Ind = Request("txt_ind")
Scelta1 = Request("scelta1")
Scelta2 = Request("scelta2")
Scelta3 = Request("scelta3")
Tel = Request("txt_tel")
Email = Request("txt_email")
Cliente = Request("sceltaCliente")
Prov = Request("sel_prov")
Comune = Request("sel_comune")
Sesso = Request("sesso")
Cap = Request("txt_cap")

Denom=Request("txt_denom")
Ragsoc=Request("txt_ragsoc")
Piva=Request("txt_piva")

Cognome=Request("txt_cogn")
Nome=Request("txt_nome")
Soci=Request("soci")
Profes=Request("sel_prof")


'VERIFICA DI SCELTA TRA PRIVATO E AZIENDA



'#####################################################################################################################
'CONTROLLO OBBLIGATORI E VERIFICA DATI CORRETTI

If Cliente = "" Then
Response.Write "Scegliere se registrarsi come cliente privato o azienda!!" & "<br><br>"
Response.Write "<A href='RegStr.htm'>Torna a registrazione</A><br><br><br>"
Response.End
End If

If (Scelta1 = "noaccetto1") or (Scelta2 = "noaccetto2") or (Scelta3 = "noaccetto3") or (Scelta1 = "") or (Scelta2 = "") or (Scelta3 = "") Then
Response.Write "Condizioni contrattuali non accettate!!" & "<br><br>"
Response.Write "<A href='RegStr.htm'>Torna a registrazione</A><br><br><br>"
Response.End
End If


'#####################################################################################################################
'CONTROLLO UTENTE

StrSQL = "SELECT * FROM ANAGRAFICA_CLIENTI WHERE User='" & Request("txt_user") & "'"
Set Rs = Cn.execute (StrSQL)

While Not rs.EOF
If rs("User") = Request("txt_user") Then
Response.Write " User già utilizzato!!" & "<br><br>"
Response.Write "<A href='RegStr.htm'>Torna a registrazione</A><br><br><br>"
Response.End
End If
rs.movenext
Wend
Rs.Close
set Rs = Nothing


'#####################################################################################################################
'CALCOLO ID_UTENTE

Set Rs = Cn.execute ("SELECT MAX (ID_CLIENTE) as idcliente FROM ANAGRAFICA_CLIENTI")
idcliente = idcliente + 1
Rs.Close
Set Rs = Nothing


'#####################################################################################################################
'MEMORIZZO I DATI NELLA TABELLA ANAGRAFICA_CLIENTI

Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "ANAGRAFICA_CLIENTI", Cn, adLockOptimistic, adCmdTable
Rs.AddNew

rs("id_cliente") = Idcliente
rs("user") = Request("txt_user")
rs("indirizzo") = Request("txt_ind")
rs("password") = Request("txt_pwd")
rs("telefono") = Request("txt_tel")
rs("e_mail") = Request("txt_email")
rs("cellulare") = Request("txt_cell")
rs("fax") = Request("txt_fax")
rs("cap") = Request("txt_cap")
rs("provincia") = Request("sel_prov")
rs("comune") = Request("sel_comune")
rs("id_stato") = Request("sceltaCliente")
rs("sesso") = Request("sesso")

Rs.Update 'Errore Microsoft OLE DB Provider for ODBC Drivers (0x80040E2F)
Rs.Close
Set Rs=Nothing


'#####################################################################################################################
'MEMORIZZO I DATI DI DETTAGLIO NELLE TABELLE DETTAGLI_AZIENDE, DETTAGLIO_PRIVATI

If Azienda Then
Set rs=Server.CreateObject("ADODB.Recordset")
Rs.Open "DETTAGLI_AZIENDE", cn, adLockOptimistic, adCmdTable
Rs.AddNew

rs("DENOMINAZIONE") = Request("txt_denom")
rs("RAGIONE_SOCIALE") = Request("txt_ragsoc")
rs("PIVA")=Request("txt_piva")


Rs.Update
Rs.Close
Set Rs=Nothing
Else
Set Rs=Server.CreateObject("ADODB.Recordset")
Rs.Open "DETTAGLIO_PRIVATI", Cn, adLockOptimistic, adCmdTable
Rs.AddNew

rs("COGNOME") = Request("txt_cogn")
rs("NOME") = Request("txt_nome")
rs("LUOGO_NASCITA") = Request("txt_luogonat")
rs("TESSERA_SOCI") = Request("soci")
rs("TITOLO_DI_STUDIO") = Request("sel_stud")
rs("PROFESSIoNE") = Request("sel_prof")
rs("CODICE_FISCALE") = Request("txt_codfisc")
rs("DATA_NASCITA") = Request("sel_dat#1") & " /" & Request("sel_dat#2") & " /" & Request ("sel_dat#3")

Rs.Update
Rs.Close
Set Rs=Nothing
End If


'#####################################################################################################################
'CHIUSURA CONNESSIONI

Cn.Close
Set Cn=Nothing

'#####################################################################################################################
'REPORT DEL CLIENTE REGISTRATO


Response.Write "<A href='RegStr.htm'>Torna a nuova registrazione</A><br><br><br>"
Response.Write "<H3>La registrazione è stata effettuata con successo!! </H3>" & "<br><br>"
Response.Write "Dati personali:" & "<br><br><br>"
Response.Write "Cognome : " & Request("txt_cogn") & "<br>"
Response.Write "Nome : " & Request("txt_nome") & "<br>"
Response.Write "Luogo di nascita : " & Request("txt_luogonat") & "<br>"
Response.Write "Data di nascita : " & Request("sel_dat#1") & " /" & Request("sel_dat#2") & " /" & Request ("sel_dat#3") & "<br>" ' DA FINIRE!!
Response.Write "Titolo di studio : " & Request("sel_stud") & "<br>"
Response.Write "Professione : " & Request("sel_prof") & "<br>"
sesso=Request("sesso")
If (Sesso="maschile") Then
Response.Write "Sesso: maschile" & "<br>"
Else
Response.Write "Sesso: femminile" & "<br>"
End If
Response.Write "Indirizzo : " & Request("txt_ind") & "<br>"
Response.Write "Provincia : " & Request("sel_prov") & "<br>"
Response.Write "Comune : " & Request("sel_comune") & "<br>"
Response.Write "CAP : " & Request("txt_cap") & "<br>"
Response.Write "Telefono : " & Request("txt_tel") & "<br>"
Response.Write "Cellulare : " & Request("txt_cell") & "<br>"
Response.Write "Fax : " & Request("txt_fax") & "<br>"
Response.Write "Email : " & Request("txt_email") & "<br>"
Response.Write "Codice fiscale : " & Request("txt_codfisc") & "<br>"
Response.Write "Partita Iva: " & Request("txt_piva") & "<br>"
soci=Request("soci")
If (Soci="si") Then
Response.Write "Tessera soci : si " & "<br>"
Else
Response.Write "Tessera soci : no " & "<br>"
End If
Response.Write "Denominazione : " & Request("txt_denom") & "<br>"
Response.Write "Ragione sociale : " & Request("txt_ragsoc") & "<br>"
Response.Write "UserId : " & Request("txt_user") & "<br>"
Response.Write "Password : " & Request("txt_pwd") & "<br><br>"
Response.Write "<A href='RegStr.htm'>Torna a nuova registrazione</A><br>"


'#####################################################################################################################
'CHIUSURA SCRIPT

%>
</body>
</html>

1 Risposte

Devi accedere o registrarti per scrivere nel forum
1 risposte