|
发表于 2009-7-12 21:04:04| 字数 2,912| - 中国–广西–玉林 电信
|
显示全部楼层
|阅读模式
用Dreamweaver cs3 按网上教程做的ASP登陆页面。
可以显示登陆页面,但输入用户名和密码 登陆不了,出错如下:
ADODB.Command 错误 '800a0bb9' 参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。 /lccz/admin/login.asp,行 24
网上找了很久都不到怎解决方法,只好求教万能的专门网了,请ASP高手帮看看,怎改了?谢谢
我是用:windows 2003 sp2 + sql 2005 + Dreamweaver cs3 来学习的。
数据库名为 web
网站虚拟目录为 lccz
源码:
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString <> "" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername = CStr(Request.Form("u"))
If MM_valUsername <> "" Then
Dim MM_fldUserAuthorization
Dim MM_redirectLoginSuccess
Dim MM_redirectLoginFailed
Dim MM_loginSQL
Dim MM_rsUser
Dim MM_rsUser_cmd
MM_fldUserAuthorization = ""
MM_redirectLoginSuccess = "admin.asp"
MM_redirectLoginFailed = "erro.asp"
MM_loginSQL = "SELECT adminsuer, adminpass"
If MM_fldUserAuthorization <> "" Then MM_loginSQL = MM_loginSQL & "," & MM_fldUserAuthorization
MM_loginSQL = MM_loginSQL & " FROM dbo.wzadmin WHERE adminsuer = ? AND adminpass = ?"
Set MM_rsUser_cmd = Server.CreateObject ("ADODB.Command")
MM_rsUser_cmd.ActiveConnection = MM_web_STRING
MM_rsUser_cmd.CommandText = MM_loginSQL
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param1", 200, 1, 50, MM_valUsername) ' adVarChar
MM_rsUser_cmd.Parameters.Append MM_rsUser_cmd.CreateParameter("param2", 200, 1, 50, Request.Form("p")) ' adVarChar
MM_rsUser_cmd.Prepared = true
Set MM_rsUser = MM_rsUser_cmd.Execute
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
用户名:
<label>
<input type="text" name="u" id="u" />
</label>
密码:
<label>
<input type="password" name="p" id="p" />
</label>
<input type="submit" name="button" id="button" value="登陆" />
</form>
</body>
</html>
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|