主题:asp与数据库连接问题
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<% if 1=request("d") then%>
<%
set conn=server.createobject("adodb.connection")
conn.open "DSN=hello;UID=sa;PWD=yuweining15083847263;"
user=trim(request.form("user"))
pwd=trim(request.form("pwd"))
set rc=conn.execute("select * from sub1 where yongh='"&user&"'")
if not rc.eof then
if rc("pwd")="" then
response.write"用户不对"
else
if "&pwd&"=rc("pwd") then
response.write"正确"
else
response.write("密码不对")
end if
end if
else response.write("用户不对")
end if
conn.close
%>
<% end if %>
<form action="login.asp?d=1" method="post"><table>
<tr>
<td>用户名:</td>
<td><input type="text"name="user"></td>
</tr>
<tr><td>密码:</td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td><input type="submit" value="登录"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table></form>
</body>
</html>
这段程序有什么错误,怎么就是运行不出正确这个选项,与数据库的连接正常,是不是表单的字符类型与数据库的类型不统一,数据库都是char型,运行不出错误,好像就是密码不会核对,密码不管对错,总是显示密码错误。求一个解决方法。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<% if 1=request("d") then%>
<%
set conn=server.createobject("adodb.connection")
conn.open "DSN=hello;UID=sa;PWD=yuweining15083847263;"
user=trim(request.form("user"))
pwd=trim(request.form("pwd"))
set rc=conn.execute("select * from sub1 where yongh='"&user&"'")
if not rc.eof then
if rc("pwd")="" then
response.write"用户不对"
else
if "&pwd&"=rc("pwd") then
response.write"正确"
else
response.write("密码不对")
end if
end if
else response.write("用户不对")
end if
conn.close
%>
<% end if %>
<form action="login.asp?d=1" method="post"><table>
<tr>
<td>用户名:</td>
<td><input type="text"name="user"></td>
</tr>
<tr><td>密码:</td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td><input type="submit" value="登录"></td>
<td><input type="reset" value="重置"></td>
</tr>
</table></form>
</body>
</html>
这段程序有什么错误,怎么就是运行不出正确这个选项,与数据库的连接正常,是不是表单的字符类型与数据库的类型不统一,数据库都是char型,运行不出错误,好像就是密码不会核对,密码不管对错,总是显示密码错误。求一个解决方法。