回 帖 发 新 帖 刷新版面

主题:一个关于删除数据库记录的问题!请高手指点!(谢谢!)

提示错误:
行: 25

字符: 43

错误: 未结束的字符串常量

代码: 0

URL: http://localhost/senky/lyb/delete.asp

具体代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>删除留言</title>
<%
sub del()
   conn.execute("delete * from gbook where id in ("&id&")")
   response.Write("<script> alert('留言删除成功,单击“确定”返回!');location.href='index.asp';</script>")
   response.End()  
end sub
sub check()
dim pwd 
pwd=request.form("password")
set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from admin where password='"&pwd&"'"
rs.open sqlstr,conn,1,1
if rs.eof or rs.bof then
  response.Write("<script> alert('密码不正确!');location.href='delete.asp</script>")
  response.End()
else
   call del()
   session("mode")=1
end if
end sub
sub index()
%>
<form method="post" name="form" action="delete.asp">
<table  align="center" width="150" bordercolor="#00CC33" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <input type="hidden" name="menu" value="<%=request.form("id")%>"/>
    <td align="center"><font color="#00CC33">请输入密码</font></td>
  </tr>
  <tr>
    <td align="center"><input type="password" size="15" name="password"/></td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="submit" value="确定"/></td>
  </tr>
</table>
</form>
<%
end sub 
%>
</head>
<body bgcolor="#000000">
<%
 if session("mode")=0 then 
   call index()
   id=request("this.form.menu")
   call check()
else 
   call del()
end if 
%>
</body>
</html>

回复列表 (共2个回复)

沙发

response.Write("<script> alert('密码不正确!');location.href='delete.asp';</script>")

板凳

谢谢,确实是那错了,但是我还是想问一下,应该怎么个写法!我一进入页面直接就弹出窗口提示密码错误,我要实现的功能是,进去页面,然后出现密码输入框,单击确定,然后提交数据到本页面,继续下面程序的执行!

我来回复

您尚未登录,请登录后再回复。点此登录或注册