急急急,50分在线等:一段asp代码在数据库为access时可以使用,但是在sql server 2000时就报错,不知什么原因,向各位大虾请教!

dqhuang 2004-08-05 11:00:27
连接access时:
<%
connstring = "driver={microsoft access driver (*.mdb)};dbq=" & server.mappath("database/data.mdb") & ""
%>

连接sql server 2000时:
<%
connstring = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hwsms;Data Source=hdq"
%>


报错页面:
Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft OLE DB Provider for SQL Server 错误 '80040e21'

无法支持要求大的属性。

/Login.asp,行21

源文件如下:
login.asp的源文件如下:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/StudentConn.asp" -->
<%
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Request.QueryString
MM_valUserName=Replace(CStr(Request.Form("UserName")),"'","")
If MM_valUserName <> "" Then
MM_fldUserAuthorization="accesslevel"
MM_redirectLoginSuccess="Index.asp"
MM_redirectLoginFailed="Login.asp?logonfailed=true"
set MM_rsUser = Server.CreateObject("ADODB.Recordset")
MM_rsUser.ActiveConnection = connstring
MM_rsUser.Source = "SELECT UserName, password"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM User WHERE UserName='" & MM_valUserName &"' AND password='" & Replace(CStr(Request.Form("password")),"'","") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open '在这儿开始报错
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 true Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Session.Timeout=600
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>

...全文
43 点赞 收藏 4
写回复
4 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
boywind 2004-08-05
还要注意一点,最好能加 trim()
因为SQL server数据库里字段未满的,就会自动加上空格的
回复
xiaozhi530 2004-08-05
同意楼上的user可能是sql中一个保留的字段
回复
icehouse 2004-08-05
DX拖拽!俺搞不定代码乱七八糟!
建议!检查一下语法结构!
回复
刘云涛 2004-08-05
MM_rsUser.Source = MM_rsUser.Source & " FROM User WHERE UserName='" & MM_valUserName &"' AND password='" & Replace(CStr(Request.Form("password")),"'","") & "'"

FROM User 改成 FROM [User]
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-05 11:00
社区公告
暂无公告