请各位ASP高手帮忙改错!
News_edit_main.asp 部分代码:… …
<table width="743" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="743" height="34" valign="top" class="STYLE2">
<%=session("name") %>发表过的文章 </td>
</tr>
<tr>
<td height="30" valign="top" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#0066FF">
<%
Dim zzhe
if session("name")="" then
Response.Write "<Script>alert('对不起,您还没有登录!');history.go(-1);</Script>"
Response.End
else
zzhe=session("name")
End if
set rs1= Server.CreateObject("adodb.recordset")
sql1= "select * from [user] where name= '" & zzhe & "'"
rs1.open sql1,conn,3,3
set rs2= Server.CreateObject("ADODB.Recordset")
if rs1("flag")<3 then
sql2="select * from [news] where editor = '"& zzhe &"' order by time desc "
else
sql2="select * from [news] order by time desc "
End if
rs2.open sql2,conn,3,3
if rs2.Bof or rs2.Eof then
Response.Write "<Script>alert('对不起,目前还没有您发表的文章!');history.go(-1);</Script>"
Response.End
End if
Do while not rs2.Eof
%>
<tr>
<td width="743" height="30" valign="top" bgcolor="#FFFFFF" class="t2">
类型:<%= rs2("class") %> 标题:<%= rs2("title") %> 发表时间:<%= rs2("time") %> <a href="News_edit.asp?id=<%= rs2("id") %>">修改</a></td>
</tr>
<%
rs2.movenext
Loop
%>
<%
rs2.close
set rs2=nothing
rs1.close
set rs1=nothing
%>
</table></td>
</tr>
<tr>
<td height="17"> </td>
</tr>
</table>
… …
News_edit.asp 部分代码:
… …
<table width="743" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#0099FF">
<!--DWLayoutTable-->
<tr>
<td width="741" height="32" align="center" valign="middle" bgcolor="#FFFFFF"><span class="STYLE1">信息修改</span></td>
</tr>
<%
dim xuhao
xuhao=Trim(Request.QueryString("id"))
set rs= Server.CreateObject("adodb.recordset")
sql= "select * from [news] where id=" & xuhao
rs.open sql,conn,3,3
%>
<form name="form2" method="post" action="News_edit.asp?action=newsedit" >
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t2">文章类别:
<input name="wzlb" type="radio" value="xw" checked="checked" />
新闻
<input type="radio" name="wzlb" value="kx" />
快迅
<input type="radio" name="wzlb" value="tz" />
通知
<input name="wzlb" type="radio" value="tg" />
通告
<input type="radio" name="wzlb" value="tb" />
通报
<input type="radio" name="wzlb" value="gb" />
公报
<input type="radio" name="wzlb" value="gs" />
公示</td>
</tr>
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t2">状态:
<input name="state" type="radio" value="pt" checked="checked" />
普通
<input type="radio" name="state" value="zy" />
重要
<input type="radio" name="state" value="jj" />
紧急</td>
</tr>
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t2">作者:
<input name="author" type="text" id="author" value="<%= rs("author") %>" /></td>
</tr>
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t2">标题:
<input name="title" type="text" id="title" value="<%= rs("title") %>" /></td>
</tr>
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t2">发布图片:
<input name="imagepath" type="file" id="imagepath" /></td>
</tr>
<tr>
<td height="32" valign="top" bgcolor="#FFFFFF" class="t3">正文</td>
</tr>
<tr>
<td height="551" align="center" valign="top" bgcolor="#FFFFFF"><textarea name="content" cols="110" rows="35" class="t4" id="content"><%= rs("content") %></textarea></td>
</tr>
<%
rs.close
set rs=nothing
%>
<tr>
<td height="31" valign="top" bgcolor="#FFFFFF" class="t3">
<input type="submit" name="Submit2" value="提交" />
<input type="reset" name="Submit3" value="重置" /></td>
</tr>
</form>
<tr>
<td height="33"> </td>
</tr>
</table>
<%
if Trim(Request.QueryString("action")) = "newsedit" then
call newsedit()
end if
%>
<%
Sub newsedit()
dim wzlb
dim state
dim author
dim title
dim imagepath
dim content
wzlb=Trim(Request.Form("wzlb"))
state=Trim(Request.Form("state"))
author=Trim(Request.Form("author"))
title=Trim(Request.Form("title"))
imagepath=Trim(Request.Form("imagepath"))
content=Trim(Request.Form("content"))
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from [news] where id= " & xuhao
rs.open sql,conn,3,3
select case wzlb
case "xw"
rs("class")="新闻"
case "kx"
rs("class")="快迅"
case "tz"
rs("class")="通知"
case "tg"
rs("class")="通告"
case "tb"
rs("class")="通报"
case "gb"
rs("class")="公报"
case "gs"
rs("class")="公示"
end select
select case state
case "pt"
rs("state")= "普通"
case "zy"
rs("state")= "重要"
case "jj"
rs("state")= "紧急"
end select
if author="" then
Response.Write "<Script>alert('请输入作者名!')</Script>"
Response.End
else
rs("author")= author
end if
if title="" then
Response.Write "<Script>alert('请输入文章标题!')</Script>"
Response.End
else
rs("title") = title
end if
if imagepath <> "" then
rs("image") = GetFileName(imagepath)
end if
if content = "" then
Response.Write "<Script>alert('文章内容不能为空!')</Script>"
Response.End
else
rs("content")= content
end if
rs("time")= Now()
rs("editor")=session("name")
rs.update
rs.close
set rs=nothing
if imagepath <> "" then
upImages(imagepath)
end if
Response.Redirect "index.asp"
End Sub
%>
… …
News_edit.asp页执行的时候报错,错误信息为:
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'id=' 中。
/News_edit.asp, 第 369 行,
我把可疑的相关代码已经标红,请各位大虾帮忙看看,到底错在哪里?不胜感激。。。