Guardate questo codice:
In locale mi funziona mentre online mi esce errore:codice:<% FUNCTION fixQuotes( theString ) fixQuotes = REPLACE( theString, "'", "''" ) END FUNCTION email = TRIM( Request( "email" ) ) ' controlla se esiste già un indirizzo mail uguale FUNCTION alreadymail( email ) sqlString = "SELECT newsletter_email FROM newsletter " &_ "WHERE newsletter_email ='" & fixQuotes( email ) & "'" Set Con = Server.CreateObject( "ADODB.Connection" ) Con.Open "dsn" SET RS = Con.Execute( sqlString ) IF RS.EOF THEN alreadymail = FALSE ELSE alreadymail = TRUE END IF RS.Close Con.Close Set Con = Nothing END FUNCTION ' verifica di una mail già presente IF alreadymail( email ) THEN Response.Write "<center>" Response.Write "Indirizzo e-mail già presente nelle liste" Response.Write "<form action='default.asp'>" Response.Write "<input type='submit' value='torna alla home page'>" Response.Write "</form>" Response.Write "</center>" ELSE ' verifica della corretta digitazione della mail FUNCTION invalidEmail( email ) Dim Reg Set Reg = New RegExp 'inizializzo la regexp Reg.Global = True Reg.Ignorecase = True Reg.pattern = "^([a-z|\d][a-z|\d|.]*)?[a-z|\d]\@[a-z|\d][a-z|\d|.]*\.[a-z|\d]+$" invalidEmail = Not(Reg.Test(email)) set Reg = Nothing END FUNCTION IF invalidEmail( email ) THEN Set Con = Server.CreateObject( "ADODB.Connection" ) Con.Open "dsn" sqlString = "INSERT INTO newsletter( newsletter_email, newsletter_dataregistrazione ) " & "VALUES ('" & fixQuotes( email ) & "', now())" Con.Execute sqlString %> <html> <head> <title>Dati registrati</title> </head> <body> I tuoi dati sono stati inseriti. Torna alla home page [/b] </body> </html> <% ELSE Response.Write "Errore nella digitazione dell' e-mail" END IF Con.Close Set Con = Nothing END IF %>
Errore di run-time di Microsoft VBScript error '800a01a8'
Necessario oggetto: ''
e viene indiucato in questa posizione:
Con.Close
Come è possibile che esca errore?
Ciaooooo

Rispondi quotando