ASP修改新闻出现:语法错误 (操作符丢失) 在查询表达式 'id='
请大家能帮我改下,好吗。联系:qq:1192742894我的源文件是这样的:
1、在新闻目录里添加传递个id:
<a href="newsedit.asp?id=<%=news("id")%>">修改</a>
2、在修改页面(newsedit.asp)中写入接收这个id:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<!--#include file="conn.asp" -->
<%
dim newsid
newsid=(trim(request.QueryString("id")))
'response.write(id)
dim news,sql
set news=server.createobject("adodb.recordset")
sql="select * from news where id="&newsid ------提示:就是错在这里
news.open sql,conn,1,1
dim title,names,pic,url,content,times
title=request.form("title")
names=request.form("name")
pic=request.form("pic")
url=request.form("url")
content=request.form("content")
times=request.form("time")
if Request("action")=2 then
Set news = Server.CreateObject("Adodb.RecordSet") '创建一个记录集对象
sql="select * from news where id="&newsid
news.Open Sql, Conn, 1, 3 '具体用RecordSetOpen方法打开Sql、Conn,游标类型用1,3,此时为更新修改
if not news.eof then
Response.Write "<script language='javascript'>alert('该项已存在,请重新输入!');history.back();</script>"
Response.End()
end if
news("title") = title
news("name") =names
news("pic")=pic
news("content") =content
news("url") =url
news("time") =times
news.Update()
'关闭记录集,
news.Close
'释放记录集的资源。
Set news = Nothing
'关闭数据库
Conn.Close
'释放数据库的资源。
Set Conn = Nothing
Response.Write "<script language='javascript'>alert('修改成功!');document.location.href('newseditml.asp');</script>"
Response.End()
end if
%>
<title>修改新闻页面</title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<table width="578" height="700" border="0" align="center" cellpadding="0" cellspacing="0" background="img/bj-12.gif" id="a1">
<tr>
<td height="40" align="center" class="zt16"> <span class="hszt16">修改新闻</span></td>
</tr>
<tr>
<td valign="top"><form action="?action=2" METHOD="POST" name="form1">
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#8DCBF0" id="a2">
<tr>
<td width="235" height="30" align="right"><span class="zt12">新闻标题:</span></td>
<td><input name="title" type="text" class="zd-180 " id="title" value="<%=news("title")%>" /></td>
</tr>
<tr>
<td height="30" align="right"><span class="zt12">新闻作者:</span></td>
<td><input name="name" type="text" class="zd-180 " id="name" value="<%=news("name")%>"></td>
</tr>
<tr>
<td height="30" align="right"><span class="zt12">新闻图片:</span></td>
<td><input name="pic" type="text" class="zd-180 " id="pic" value="<%=news("pic")%>"></td>
</tr>
<tr>
<td height="30" align="right"><span class="zt12">相关连接:</span></td>
<td><input name="url" type="text" class="zd-180 " id="url" value="<%=news("url")%>" /></td>
</tr>
<tr>
<td align="right"><span class="zt12">新闻内容:</span></td>
<td><p>
<textarea name="content" id="content"><%=news("content")%></textarea>
</td>
</tr>
<tr>
<td height="30" colspan="2" align="center"><span class="STYLE1">
<input name="submit" type="submit" id="submit" value="修 改" />
</span></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td height="30"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<%
news.close
set news=nothing
conn.close
set conn=nothing
%>
希望各位能帮我下呢,谢谢大家!!!qq:1192742894