错误类型:Microsoft JET Database Engine (0x80040E14)FROM 子句语法错误。/myweb/const.asp, 第 25 行 整了一整天了,帮我找找错在哪里啊谢谢大家了

hx37906 2008-04-16 10:11:57
<!--#include file="const.asp"-->
<%
dim sql
dim rs
dim tflag
dim opmessage
dim pagesize
dim pgnm
dim page
dim count
count=0
pagesize=9
sql="select [管理员.tname],[公告表.tid] from 管理员,公告表"
sql=sql & "where 管理员.id=[公告表.tid]"
sql=sql & "order by [公告表.id] desc"
%>
<html>
<head><meta http-equiv="content-language" content="zh-cn">
<title>已发信息列表</title>
<link rel="stylesheet" type="text/css" href="link.css">
<script language="javascript" type="text/javascript">
<!--
function MM_jumpMenu(targ,selobj,restore){//v3.0
eval(targ+".location='"+selobj.options[selobj.selectedindex].value+"'");
if(restore) selobj.selectedindex=0;}//-->
</script></head><body>
<div align="center">
<table border="1" width="700" id="table2" cellspacing="0" cellpadding="0" style="border-collapse:collapse" height="32">
<tr>
<td align="center">当前操作:公告列表</td>
</tr>
</table>
<br>
<%
set rs=executequery(sql)
if(rs.eof) then
response.write("暂时没有任何公告!")
else
rs.pagesize=pagesize
pgnm=rs.pagecount
if(isempty(page) or cint(page)<1 or cint(page)>pgnm) then
page=1
end if
rs.absolutepage=page
%>
<table border="1" width="700" id="table1" cellspacing="0" cellpadding="0" style="border-collapse:collapse" height="78" bordercolor="#cccccc">
<tr>
<td width="84" height="25" align="center">发布人</td>
<td width="300" height="25" align="center">标题</td>
<td width="86" height="25" align="center">发布时间</td>
<td height="25" align="center">操作</td>
</tr>
<%
while(not rs.eof)
if(session("userflag")="管理员" or session("userid")=rs("tid")) then
opmessage="<a href=shownotice.asp?nid=" & rs("id")
opmessage=opmessage & ">查看</a>/"
opmessage=opmessage & "<a href=changenotice.asp?nid=" & rs("id")
opmessage=opmessage & ">修改</a>/"
opmessage=opmessage & "<a href=messagenotice.asp?actiontype=delete&nid=" & rs("id")
opmessage=opmessage & ">删除</a>"
else
opmessage="<a href=shownotice.asp?nid=" & rs("id")
opmessage=opmessage & ">查看</a>"
end if
%>
<tr>
<td width="84" height="25" align="center"><%=rs("tname")%></td>
<td width="300" height="25">  
<a href="shownotice.asp?nid=<%=rs("id")%>"><%=rs("ntitle")%></a></td>
<td width="86" height="25" align="center"><%=opmessage%></td></tr>
<%
rs.movenext()
wend
%>
<tr>
<td align="right" height="26" colspan="4"><%if page=1 then%>
<font color="#cccccc">上一页</font><%else%>
<a href="listnotice.asp?page=<%=page-1%>">上一页</a><%end if%> <%if page\pgnm=0 then%><a href="listnotice.asp?page=<%=page+1%>">下一页</a><%else%>
<font color="#cccccc">下一页</font><%end if%>共<font color="#ff0000"><%=rs.recordcount%></font>条信息,每页<font color="#ff0000"><%=pagesize%></font>条,共<font color="#ff0000"><%=pgnm%></font>页,<span lang="zh-cn">当前为第<font color="#ff0000"><%=page%></font>页,</span>跳转到<select name="page" onchange="MM_jumpMenu('this',this,0)"
style="border:1px solid #8293e6; font-size:9pt;width=62px;height=16px;color:#111111;background-color:#ddddff"><option selected value="#">请选择</option>
<%for i=1 to pgnm%>
<option value="listnotice.asp?page=<%=i%>">第<%=i%>页</option>
<%next%></select></td></tr></table>
<%
end if%></div></body></html>
...全文
451 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
mysite365 2008-04-17
  • 打赏
  • 举报
回复
rcs.open sql,conn,1,1
你看看存在吗???
MeXP 2008-04-16
  • 打赏
  • 举报
回复
connstr=connstr & Server.MapPath(""&db&"")
改为
connstr=connstr & Server.MapPath(db)
hx37906 2008-04-16
  • 打赏
  • 举报
回复
const.asp
<%
response.expires=0
dim db
db="公告.mdb"
sub executenonquery(sql)
dim conn
dim connstr
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr=connstr & Server.MapPath(""&db&"")
conn.Open connstr
conn.execute sql
conn. close
set conn=nothing
end sub
function executequery(sql)
dim conn
dim connstr
dim rcs
set conn=server.createobject("adodb.connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
connstr=connstr & Server.MapPath(""&db&"")
conn.Open connstr
set rcs=server.createobject("adodb.recordset")
rcs.open sql,conn,1,1
set executequery=rcs
end function
sub alert(message)
message=replace(message,"'","\'")
message=replace(message,chr(13),"\n")
message=replace(message,chr(10),"")
response.write("<script>alert('"&message&"')</script>")
end sub
sub goback()
response.write("<script>history.go(-1)</script>")
response.write("<script>location.refresh()</script>")
end sub
sub go(url)
response.write("<script>location.href('"&url&"')</script>")
end sub
function htmlencode2(str)
dim result
dim l
if isnull(str) then
htmlencode2=""
exit function
end if
l=len(str)
result=""
dim i
for i=1 to l
select case mid(str,i,l)
case "<"
resule=resule+"<"
case ">"
resule=resule+">"
case chr(13)
resule=resule+"<br>"
case chr(34)
resule=resule+"""
case "&"
resule=resule+"&"
case chr(32)
if i+1<=1 and i-1>0 then
if mid(str,i+1,l)=chr(32) or mid(str,i+1,l)=chr(9) or mid(str,i-1,l)=chr(32) or mid(str,i-1,l)=chr(9) then
resule=resule+" "
else
result=result+""
end if
else
resule=resule+" "
end if
case chr(9)
result=result+""
case else
resule=resule+mid(str,i,l)
end select
next
htmlencode2=result
end function
function checkstr(str)
dim tstr,l,i,ch
str=trim(str)
l=len(str)
for i=1 to l
ch=mid(str,i,l)
if ch="'" then
tstr=tstr+"'"
end if
tstr=tstr+ch
next
checkstr=tstr
end function
%>

MeXP 2008-04-16
  • 打赏
  • 举报
回复
sql="select [管理员.tname],[公告表.tid] from 管理员,公告表"
sql=sql & "where 管理员.id=[公告表.tid]"
sql=sql & "order by [公告表.id] desc"
这两句也有问题
连接号字符串后没有空格,会出错的

建议,不要用中文表名,会在某些情况下出错
MeXP 2008-04-16
  • 打赏
  • 举报
回复
该帖的没有贴出来,是const.asp出错了,贴出来

28,409

社区成员

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

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