当打开login.htm输入用户和密码时,转入login.asp,由其查询数据库,看用户和密码是否正确,但老提示dbconn.asp中的oconn.open strconn 错误,盼高手指点!
dbconn.asp
<%
dim oconn
dim strconn
set oconn=server.createobject("adodb.connection")
strconn="provider=SQLOLEDB;DATA SOURCE=LOCAL;uid=yzh;pwd=19790615;datebase=user_information"
oconn.open strconn
%>
login.htm
<html>   
<body>   
<p>用户登录界面</p>   
<form method="post" action="login.asp">   
<p>
用户名<input type="text" name="userid" size="20"><br>  
密码<input type="text" name="passwd" size="20"><br>  
</p>   
<input type="submit" value="发送" name="B1"><p>   
</form>   
</body>
</html> login.asp
<%
if len(request.form("userid"))=0 and len(request.form("passwd"))=0
then
response.redirect"../login.htm"
end if
function loginnow()
dim id
dim passwd
id=request.form("userid")
passwd=request.form("passwd")
%>
<!--#include file="dbconn.asp"-->
<%
set rst=server.createobject("adodb.recordset")
strsql="select * from id_passwd where id='"&id&"'"
rst.open strsql
if not rst.eof then
if trim(passwd)=trim(rst("passwd")) then
session("idlogin")=1
session("userid")=id
loginnow=1
exit function
else
loginnow=0
exit function
end if
end if
loginnow=-1
end functiondim isuser
isuser=loginnow()
if isuser=1 then
response.redirect"../bbslist.htm"
else if isuser=0 then
response.redirect"../error.htm"
else
response.redirect"../nouser.htm"
end if
end if
%>