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

dqhuang 2004-08-05 10:25:22
连接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

...全文
48 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ycted 2004-08-05
问题出现在你的SQL语句上.你自己把要执行的sql语句response.write出来看看,对不对.然后放到查询分析器里执行看看.
回复
MM_rsUser.Source = MM_rsUser.Source & " FROM [User] WHERE UserName='" & MM_valUserName &"' AND [password]='" & Replace(CStr(Request.Form

这样试试,基本是sql语句的错误反正
回复
dqhuang 2004-08-05
源文件如下:
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
%>
回复
wsdzmhongm 2004-08-05
connstr="driver={SQL Server};server=host_name;uid=username;pwd=password;database=database_name"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open connstr
回复
skyboy0720 2004-08-05
21行是哪一行?!
多帖些关键的代码!
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

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