大虾们,请帮帮忙(asp 的问题)
错误类型:
Microsoft VBScript 编译器错误 (0x800A0401)
/asp/copy-news/admin/classify.asp, 第 115 行, 第 57 列
Response.Write "<a href='javascript:confirmDel( "& " rs("id") &")'>删除</a></td></tr>"
--------------------------------------------------------^
源代码?
<%@ Language=VBScript %>
<% option explicit %>
<!--#include file="database.asp"-->
<!--#include file="../change.inc"-->
<!--#include file="chkadmin.asp"-->
<%
dim curaction, curid, bedit, founderr, errmsg
curaction = request("action")
curid = request("id")
bedit = false
founderr = false
if curaction = "edit" then
bedit = true
end if
dim sql
'删除记录
if curaction = "delete" then
sql = "DELETE FROM category WHERE id=" + cstr(curid)
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
response.write "记录已经删除。"
end if
end if
'添加记录
if curaction = "newsave" then
if trim(request("txttitle")) = "" then
founderr = true
errmsg = "<p>请输入类别!</p>"
end if
if founderr then
response.write errmsg
else
sql = "INSERT INTO category(title) VALUES('"
sql = sql + cstr(request("txttitle")) + "')"
conn.execute sql
if err.number <> 0 then
response.write "无法保存,数据库操作出错:" + err.description
else
response.write "记录已经添加到数据库。"
end if
end if
end if
'保存记录
if curaction = "editsave" then
if trim(request("txttitle")) = "" then
founderr = true
errmsg = "<p>请输入类别!</p>"
end if
if founderr then
response.write errmsg
else
sql = "UPDATE category SET "
sql = sql + "title='" + htmlencode(request("txttitle")) + "'"
sql = sql + " WHERE id = " + cstr(curid)
conn.execute sql
if err.number <> 0 then
response.write "无法保存,数据库操作出错:" + err.description
else
response.write "记录已经更新到数据库。"
end if
end if
end if
%>
<html>
<head>
<title>站点更新管理</title>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../news.css">
<script language="javascript">
function confirmDel(id){
if ( confirm("你确定要删除吗?")) {
window.location.href = "classify.asp?action=delete&id=" + id
}
}
</script>
</head>
<body>
<%
dim rs
set rs = server.createobject("adodb.recordset")
sql = "SELECT * FROM category"
rs.open sql, conn, 1, 1
if err.number <> 0 then
response.write "数据库操作失败:"&err.description
else
if rs.eof and rs.bof then
response.write "没有记录"
else
%>
<table width="100%" border="1" cellspacing="0" align="CENTER" bordercolor=<%= TBCOLOR %>>
<tr bgcolor=<%= THCOLOR %>>
<td width="70%"><b>类别</b></td>
<td width="30%"><b>操作</b></td></tr>
<% do while not rs.eof
dim tdcolor
tdcolor = TDCOLORL
if bedit then
if clng(rs("id")) = clng(curid) then
tdcolor = TDCOLORD
end if
end if
response.Write "<tr bgcolor=" & tdcolor & ">"
Response.Write "<td>"& rs("title") &"</td>"
Response.Write "<td><a href='classify.asp?action=edit&id=" & cstr(rs("id")) & "'>编辑</a> "
Response.Write "<a href='javascript:confirmDel( "& " rs("id") &")'>删除</a></td></tr>"
rs.movenext
loop
Response.Write "</table>"
End If
rs.close
end if
Response.Write "<hr>"
if bedit then
sql = "SELECT * FROM category WHERE id = " + cstr(curid)
rs.open sql, conn, 1, 1
end if
%>
<form action="classify.asp" method="POST">
<p align=center><b><% If bedit then %>编辑:<% Else %>添加:<% End If %></b></p>
<table align=center cellspacing="0" cellpadding="2" border="1" bordercolor=<%= TBCOLOR %>>
<tr>
<td width="10%" bgcolor=<%= TDCOLORD %>><b>类别:</b></td>
<td width="90%" bgcolor=<%= TDCOLORL %>>
response.Write "<input type=Text name=txttitle size=50 value='"
If bedit then
response.write rs("title")
end if
Response.WRite "'></td>"
%>
</tr>
<tr><td align=center colspan="2" bgcolor=<%= TDCOLORD %>>
<input type="Hidden" name="action" value='<% If bedit then%>editsave<% Else %>newsave<% End If %>'>
<%
If bedit then
Response.Write "<input type=Hidden name=id value='"& cstr(curid) &"'>"
End If
%>
<input type="Submit" name="btnsave" value="保存">
<input type="Reset" value="取消"></td></tr>
</table>
</form>
<%
set rs = nothing
call endconnection()
%>
</body>
</html>