王陆和帝琉第几章:ASP问题,急!!!!

来源:百度文库 编辑:高考问答 时间:2024/05/10 10:59:41
请教高高手,我的网页有问题,但不知问题在哪?拜托...感激不尽!!!
<!--#include file="conn.asp"-->
<!--#include file="isadmin.asp"-->
<%
id = trim(request("yiqiid"))
fenhao = server.htmlencode(trim(request("fenhao")))
yiqiname = server.htmlencode(trim(request("yiqiname")))
xinghao = server.htmlencode(trim(request("xinghao")))
guige = server.htmlencode(trim(request("guige")))
price = server.htmlencode(trim(request("price")))
xz = server.htmlencode(trim(request("xz")))

if fenhao = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入仪器分号');history.go(-1);</script>"
response.end
end if
if yiqiname = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入仪器名称');history.go(-1);</script>"
response.end
end if
if xinghao = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入型号');history.go(-1);</script>"
response.end
end if

if guige = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入仪器规格');history.go(-1);</script>"
response.end
end if
if price = "" then
conn.close
set conn = nothing
response.write "<script>alert('请输入仪器单价');history.go(-1);</script>"
response.end
end if

sql = "select * from shebei where yiqiid="&id
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,3
if rs.bof and rs.eof then
rs.close
set rs = nothing
conn.close
set conn = nothing
response.write "<script>alert('请不要捣乱');top.window.location.href='adminmain.asp';</script>"
response.end
else
rs("fenhao")=fenhao
rs("yiqiname")=yiqiname
rs("xinghao")=xinghao
rs("guige")=guige
rs("price")=price
rs.update
rs.close
set rs = nothing
conn.close
set conn = nothing
end if
response.write "<script>alert('修改成功');window.location.href='editshebei.asp?id="&id&"';</script>"

%>
现象:第1行"="附近有语法错误
我把 sql = "select * from shebei where yiqiid="&id 改成sql = "select * from shebei "就能成功,但response.write "<script>alert('修改成功');window.location.href='editshebei.asp?id="&id&"';</script>"
又找不到链接.非常谢谢你!

id = trim(request("yiqiid")) 中上一页的yiqiid变量没有传输到!!!

问题现象描述出来!!!

<!--#include file="conn.asp"-->
路径是否正确。conn.asp是否与当前文件在同一目录?

就是,这个程序看不出来有什么错误,请再检查别的文件!

应该是conn.asp文件的第一行有问题,
我猜测你可能是定义变量的时候赋值给变量了,
如:
Dim temp = 123
那么就会出错
改成:
Dim temp
temp = 123

连接出错 这个文件没错 要不就是关键字被你用了才会出现这个 这个主要出现在SQL 数据库里