运行时错误 800a01c2

Runtime Error 800a01c2

我收到以下错误:

Line 24 error message Microsoft VBScript runtime error '800a01c2' Wrong number of arguments or invalid property assignment.

第 24 行是:

set strPassword = objDB("medacist_password")

完整代码:

<%
DIM strEmail
strEmail = Request.Form("email")

IF strEmail <> "" THEN
%>
<%
DIM objDB, rs, rssql
Set objDB = Server.CreateObject("ADODB.Connection")
objDB.Open "Provider=MSDASQL.1;Password=langas;Persist Security Info=True;User ID=mmsg;Data Source=mmsg_web"
rssql = "SELECT email_addr, medacist_password FROM medacist_user WHERE email_addr = '" & strEmail & "'"
Set rs = objDB.Execute(rssql) 
IF rs.EOF THEN
    Response.Write "That email address was not found in our database. Please click Back on your browser and enter the email address you registered with."
ELSE
    DIM strPassword
    set strPassword = objDB("medacist_password")
    DIM mail, objMail
    Set objMail = Server.CreateObject("CDOSYS.NewMail") 
    objMail.From = "clu@medacist.com"
    objMail.Subject = "Password"
    objMail.To = strEmail
    objMail.Body = "Here is your login password: " & strEmail 
    objMail.Send

    'Set objMail to nothing to destory the mail object'
    Set objMail = nothing

    Response.Write "Your password has been sent to your email address."
END IF

ELSE
    Response.Write "Please click Back on your browser and enter the email address you registered with."
END IF
%>

VBScript 中的"Set"关键字仅用于将对象赋值给变量。但是,记录集中的值不是对象,只是一个普通字符串。

将代码改成这样就可以了:

strPassword = rs("medacist_password")