Microsoft JET Database Engine (0x80040E10)至少一个参数没有被指定值。/ADOFunctions.asp, 第 25 行

xueshi 2005-03-29 08:38:02
今天 晚上 在调试ASP

本来 都好好的 要备份一下 结果 在重新用 IIS 打开网页 就显示 这样的错误

Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'user_id=' 中。
/复件 hehe/ADOFunctions.asp, 第 25 行

Microsoft JET Database Engine (0x80040E10)
至少一个参数没有被指定值。
/复件 hehe/ADOFunctions.asp, 第 25 行


ADOFunctions.asp 里面部分 内容如下:



Function GetSQLRecordset(strSQL, FileName, TableName)
'使用Connection对象打开数据库文件
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath(FileName)
objConn.Open

'从数据表中读取符合SQL语句的记录并存放在Recordset对象中
24: Set GetSQLRecordset = Server.CreateObject("ADODB.Recordset")
25: GetSQLRecordset.Open strSQL, objConn, adOpenKeyset, adLockOptimistic, adCmdText
26: End Function


没有改动过 以前没有错误的代码 也是这样的错误

真心请教 先谢谢了
...全文
1034 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lstup 2005-03-29
  • 打赏
  • 举报
回复
在开头加:
if Session("User_id")="" then
response.write "<script>alert('您为登陆!');top.location.href='login.asp';</script>"
end if
不过在跳转前,rs该关闭的就要关闭。
lickies 2005-03-29
  • 打赏
  • 举报
回复
如果是第一次登陆的话。。。
你可以这样
if Session("User_id")="" then
执行第一次登陆的代码
else
执行第二次登陆的代码
end if

还有。不知道是我太笨还是啥。。我不知道你的END IF 加在哪。。我从你代码里看不到你的IF在哪啊
最好要看全部原码就晓得咯
xueshi 2005-03-29
  • 打赏
  • 举报
回复
刚刚 加上

<% '
VisitorName = request.cookies("MySiteVisitorName")
if VisitorName = "" then
Response.write "Hi, guest! I hope you are having a great day!"
else
Response.write "Hi, " & VisitorName & "! I hope you are having a great day!"
end if


Dim objRS2,objRS3,strSQL2,strSQL3

'strSQL1 = "SELECT * FROM links where user_name='"& VisitorName &"' "
strSQL2 = "select * from groups where user_id=" & Session("User_id") & " order by orderid"
strSQL3 = "select * from links where user_id=" & Session("User_id") & " order by link_name"

' Set objRS = GetSQLRecordset(strSQL1, "abc.mdb", "links")
Set objRS2 = GetSQLRecordset(strSQL2, "abc.mdb", "groups")
Set objRS3 = GetSQLRecordset(strSQL3, "abc.mdb", "links")


%>



不过 end if 不知道 要加到哪里? 因为 网页末尾还有 关闭数据库的代码

<%

'关闭数据库连接并释放对象
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing

%>

唉 谢谢 大家的关注 我再想想看 end if 如果加到末尾的话 那么因为没有登录 好多都不显示了

我做的类似 论坛的 直接首页上 有登录的 支持cookie

Session("User_id") 是在 密码验证的页面 设置的

关键现在 怎么是 如果第一次登录的话 怎样屏蔽 Session("User_id")?
menrock 2005-03-29
  • 打赏
  • 举报
回复
你代码里面没检测session是否为空?
TSD 2005-03-29
  • 打赏
  • 举报
回复
提交的参数有错了!
xueshi 2005-03-29
  • 打赏
  • 举报
回复
strSQL2 = "select * from groups where user_id=" & Session("User_id") & " order by orderid"
strSQL3 = "select * from links where user_id=" & Session("User_id") & " order by link_name"

好像 没有 不过 一旦 建立会话 就可以用了

User_id 是在 用户登录 验证的那个页面

If user_name = Lcase(rs("user_name")) AND passwd = rs("passwd") Then

Session("loginfailure") = False
session("user_id") = rs("user_id")
session("user_name")=user_name


我好像 明白错在哪里了 不过 还是没法解决
menrock 2005-03-29
  • 打赏
  • 举报
回复
确定有递交user_id参数吗?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧