다음과 같이 전자 메일이 테이블에 있는지 확인하는 코드가있는 고전적인 ASP 페이지가 있습니다.전자 메일이 있는지 확인하십시오.
<%
'' //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
%>
그러나이 페이지는 다음 오류를보고합니다.
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
라인 19는 다음과 같습니다.
countEmail = CmdCheckEmail("CountEmail")
전자 메일은 테이블에 존재하며 테이블에는 다음과 같은 열이 있습니다. ReferredEmail 및 ReferredCode
누구든지이 오류에 불을 붙일 수 있는지 궁금하네요?
감사합니다.
@Orbman - 저는 MSSQL 데이터베이스를 사용하고 있지만 'CountEmail'또는 CountEmail을 사용 하던지 동일한 오류를 계속보고합니다 : ( – doubleplusgood
) cmd 개체가 잘못되었습니다. 내 편집을 참조하십시오. – RedFilter
감사합니다. Orbman. 지금 필요한 개체가 있습니다. 'conn' /default2.asp, 줄 20 오류 – doubleplusgood