下面这段代码运行后不能显示输出的密码,
<%
Dim conn
Set conn=Server.CreateObject("ADODB.RecordSet")
conn.ActiveConnection = "DSN=my;User ID=sa;pwd=123"
conn.Source = "select * from dbo.student where stu_id='"&request.Form("textfiled1")&"'and stu_email='"&request.Form("textfiled2")&"'"
conn.CursorType = 0
conn.LockType = 1
conn.Open()
if conn.eof then
response.Write("请你<a href='reg.asp' target=_blank>重新注册</a>或者<a href='lookpwd.asp' >重新输入自己的信息</a>")
conn.Close()
Set conn = Nothing
response.End
end  if
%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>找回密码</title>
<link href="../css/Style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.STYLE1 {font-family: "宋体"}
-->
</style>
</head><body>
<!--#include file=../top.asp-->
<table width="244" height="89" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><span class="STYLE1">你的密码是</span></td>
  </tr>
  <tr>
    <td><%conn("stu_pass")%></td>
  </tr>
  <tr>
    <td>&nbsp; 退出</td>
  </tr>
</table>
<%
conn.Close()
Set conn = Nothing%>

解决方案 »

  1.   

    ASP 曾经熟悉  放到.NET版块吧!
      

  2.   

    <%=conn("stu_pass")%>
      

  3.   

    <%
    response.write conn.recordcount & "<BR>"
    response.write conn(0) & "<BR>"
    response.write conn(1) & "<BR>"
    response.write conn(2) & "<BR>"
    %>在对象关闭前加上这几句话,检查记录集记录数和第一条记录前三个字段的值.
      

  4.   

    谢谢啦!但是我运行之后直接执行了response.Write("请你<a href='reg.asp' target=_blank>重新注册</a>或者<a href='lookpwd.asp' >重新输入自己的信息</a>") 所以是不是if那有问题啊?该怎么改?
      

  5.   

    换下面的试试:
    dim objconn1,conn1
    objconn1="provider=SQLOLEDB.1;Data Source=Ip;user ID=User;Password=pas;inital Catalog=database"
    set conn1=server.createobject("ADODB.CONNECTION")
    if err then
    err.clear
    else
    conn1.open objconn1
    end if
    dim sql,rs,i
    Set rs= Server.CreateObject("ADODB.Recordset")
    sql="select * from dbo.student where stu_id='"&request.Form("textfiled1")&"'and stu_email='"&request.Form("textfiled2")&"'"
    rs.open sql,conn1,1,1
    if rs.eof then
      

  6.   

    不可能啊~~这个是我可以执行的代码,你的数据库是SQL么?
    是的话~~你检查你的SQL语句~~"'and这个前面缺少空格~~
    可以使用
    Response.Write(sql)
    在rs.open sql,conn1,1,1
    这句前面,输出来看看
      

  7.   

    将你的程序前后顺序换了一下 试试?
    <%
    Dim conn
    Set conn=Server.CreateObject("ADODB.RecordSet")
    conn.ActiveConnection = "DSN=my;User ID=sa;pwd=123"
    conn.Source = "select * from dbo.student where stu_id='"&request.Form("textfiled1")&"'and stu_email='"&request.Form("textfiled2")&"'"
    conn.CursorType = 0
    conn.LockType = 1
    conn.Open()
    if conn.eof then
    response.Write("请你<a href='reg.asp' target=_blank>重新注册</a>或者<a href='lookpwd.asp' >重新输入自己的信息</a>")
    response.End
    else
     pass=conn("stu_pass")
    end if
    conn.Close()
    Set conn = Nothing
    %><html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>找回密码</title>
    <link href="../css/Style.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .STYLE1 {font-family: "宋体"}
    -->
    </style>
    </head><body>
    <!--#include file=../top.asp-->
    <table width="244" height="89" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
      <td><span class="STYLE1">你的密码是</span></td>
      </tr>
      <tr>
      <td><%=pass%></td>
      </tr>
      <tr>
      <td>&nbsp; 退出</td>
      </tr>
    </table>