800a0bb9与经典asp的连接错误

时间:2015-01-08 14:24:30

标签: mysql asp-classic

错误ADODB.Connection错误' 800a0bb9'第16行如果objRS.EOF那我的代码有什么问题?我知道我的所有用户名和密码以及数据源都是正确的。我用我的其他连接测试它,它工作正常。只是这个代码。



    <%
    DIM strUsername
    strUsername = Request.Form("Username")
    IF strUsername <> "" THEN
    %>

    <!--#inlcude file="confirm_test.asp"-->

    <%
    DIM mySQL, objRS, rs 
    Set objRS = Server.CreateObject("ADODB.Connection")
    objRS.Open "Provider=MSDASQL.1;Password=lafgfngas;Persist Security Info=True;User ID=mmdsg;Data Source=mmsdsg_web"  
    mySQL = "SELECT username, email_addr  FROM medacist_user WHERE username = '" & strUsername & " ' "
    Set rs = objRS.Execute(mySQL)

    IF objRS.EOF THEN
    Response.Write "<div align='center'>Sorry, that username does not exist. Please click back on your browser and enter a different username.</div>"

    ELSE
    %>

    <form name="UpdatePassword" method="post" action="reset_form.asp">
    <table>
    <tr><td>Username:</td><td>
    <input type="text" name="Username" size="50" value='<%=objRS("Username")%>'>
    </td></tr>
    <tr><td>Password:</td><td>
    <input type="text" name="Password" size="50" value='<%=objRS("Password")%>'>
    </td></tr>
    </table>
    <input type="submit" name="Submit" value="Reset">
    </form>

    <%
    END IF

    objRS.Close
    Set objRS = Nothing
    %>

    <%
    ELSE
    Response.Write "Please click back on your browser and enter your username."
    END IF
    %>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:2)

尝试

IF rs.EOF THEN

您正在测试您的记录集是否为空,而不是您的连接对象