J'ai une page ASP classique avec du code pour vérifier si un e-mail existe dans la table comme suit;Vérifiez si l'e-mail existe
<%
'' //Check the submitted email against existing ones in the database
set CmdCheckEmail = server.CreateObject("ADODB.Command")
CmdCheckEmail.ActiveConnection = MM_dbconn_STRING
CmdCheckEmail.CommandText = "SELECT COUNT(ReferredEmail) AS 'CountEmail' FROM TenantReferral WHERE ReferredEmail = '" & Request("Email") & "'"
Response.Write(CmdCheckEmail.CommandText)
CmdCheckEmail.CommandType = 1
CmdCheckEmail.CommandTimeout = 0
CmdCheckEmail.Prepared = true
CmdCheckEmail.Execute()
countEmail = CmdCheckEmail("CountEmail")
set CmdCheckEmail = nothing
conn.close
set conn = nothing
If(countEmail >= 1) Then
Message = Message & "<p>This email address has already been referred.</p>"
End If
%>
Cependant, la page signale l'erreur suivante;
SELECT COUNT(ReferredEmail) AS 'CountEmail' FROM TenantReferral WHERE ReferredEmail = '[email protected]'
ADODB.Command error '800a0cc1'
Item cannot be found in the collection corresponding to the requested name or ordinal.
/default2.asp, line 19
La ligne 19 est la suivante;
countEmail = CmdCheckEmail("CountEmail")
L'e-mail existe dans la table et la table contient simplement les colonnes suivantes; ReferredEmail et ReferredCode
Je me demandais si quelqu'un pourrait être en mesure de faire la lumière sur cette erreur?
Merci.
@Orbman - J'utilise une base de données MSSQL, mais je signale toujours la même erreur en utilisant 'CountEmail' ou CountEmail :( – doubleplusgood
Vous utilisez le cmd objet incorrectement, voir mon édition – RedFilter
Merci Orbman. Je reçois maintenant un objet requis: 'conn' /default2.asp, erreur de ligne 20. – doubleplusgood