网站后台
<%@language=vbscript codepage=936 %><!--#include file="../include/nAdminCheck.asp"-->
<%ConnPath="../../"%>
<!--#include file="../include/conn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim Action,BigClassName,SmallClassName,rs,FoundErr,ErrMsg
Action=trim(Request("Action"))
BigClassID=trim(request("BigClassID"))
SmallClassName=trim(request("SmallClassName"))
SmallClassName_en=trim(request("SmallClassName_en"))
if Action="Add" then
comment=Request("comment")
nImg=trim(request("nImg"))
if BigClassID="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>请先选择大栏目名称!</li>"
end if
if SmallClassName="" then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>文章子栏目名不能为空!</li>"
end if
if FoundErr<>True then
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * From pnClass Where Class_ID="&Cint(BigClassID)&" AND nClass_Name='" & SmallClassName & "'",conn,1,3
if not rs.EOF then
FoundErr=True
ErrMsg=ErrMsg & "<br><li>该大栏目中已经存在子栏目“" & SmallClassName & "”!</li>"
else
rs.addnew
rs("Class_ID")=BigClassID
rs("nClass_Name")=SmallClassName
rs("nClass_Name_en")=SmallClassName_en
rs("nImg")=cImg
rs("comment")=comment
rs.update
rs.Close
set rs=Nothing
call CloseConn()
Response.Redirect "ClassManage.asp"
end if
end if
end if
if FoundErr=True then
call WriteErrMsg()
else
%>
<script language="JavaScript" type="text/JavaScript">
function checkSmall()
{
if (document.form2.BigClassID.value=="")
{
alert("请先选择大栏目名称!");
document.form2.BigClassID.focus();
return false;
}
if (document.form2.SmallClassName.value=="")
{
alert("子栏目中文名称不能为空!");
document.form2.SmallClassName.focus();
return false;
}
if (document.form2.SmallClassName_en.value=="")
{
alert("子栏目英文名称不能为空!");
document.form2.SmallClassName_en.focus();
return false;
}
}
</script>
<link href="../include/sys.css" rel="stylesheet" type="text/css">
<div align="center">
<p> </p>
<p><a href="classmanage.asp" class="white"><strong>栏 目 设 置</strong></a>
<br>
</p>
</div>
<table width="452" border="0" align="center" cellpadding="3" cellspacing="1" class="TABLEresult">
<form name="form2" method="post" action="ClassAddSmall.asp" onsubmit="return checkSmall()">
<tr bgcolor="#999999" class="title">
<td height="25" colspan="2" align="center" background="../include/sys.gif"><strong class="head">添加子栏目</strong></td>
</tr>
<tr class="tdbg">
<td width="113" height="22" align="center" bgcolor="#C0C0C0"><strong class="jingfont">所属大栏目:</strong></td>
<td width="324" bgcolor="#E3E3E3"> <select name="BigClassID" class="textinput">
<%
dim rsBigClass
set rsBigClass=server.CreateObject("adodb.recordset")
rsBigClass.open "Select * From pClass",conn,1,1
if rsBigClass.bof and rsBigClass.bof then
response.write "<option>请先添加大栏目</option>"
else
do while not rsBigClass.eof
if rsBigClass("Class_ID")=Cint(BigClassID) then
response.write "<option value='"& rsBigClass("Class_ID") & "' selected>" & rsBigClass("Class_Name") & "</option>"
else
response.write "<option value='"& rsBigClass("Class_ID") & "'>" & rsBigClass("Class_Name") & "</option>"
end if
rsBigClass.movenext
loop
end if
rsBigClass.close
set rsBigClass=nothing
%>
</select></td>
</tr>
<tr class="tdbg">
<td width="113" height="22" align="center" bgcolor="#C0C0C0"><strong>子栏目中文名称:</strong></td>
<td bgcolor="#E3E3E3"> <input name="SmallClassName" type="text" class="textinput" size="20" maxlength="30"></td>
</tr>
<tr class="tdbg">
<td width="113" height="11" align="center" bgcolor="#C0C0C0"><strong>子栏目英文名称:</strong></td>
<td bgcolor="#E3E3E3"><input name="SmallClassName_en" type="text" class="textinput" id="SmallClassName_en" size="20" maxlength="30" /></td>
</tr>
<tr bgcolor="#E3E3E3" class="tdbg">
<td width="113" height="22" bgcolor="#C0C0C0">
<div align="right" class="font"><strong>栏目图片:</strong></div> </td>
<td width="324" bgcolor="#E3E3E3">
<input name="nImg" type="text" class="textinput" id="nImg" size="30" maxlength="50">
<input class="textbotton1" type="button" name="up_pic" value="小图片上传" onClick="window.open('../Up_Pic.asp?formname=form1&editname=nImg&uppath=../uploadfile&filelx=pic','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')"> </td>
</tr>
<tr bgcolor="#E3E3E3" class="tdbg">
<td width="113" height="22" bgcolor="#C0C0C0">
<div align="right" class="font"><strong>栏目介绍:</strong></div> </td>
<td width="324" bgcolor="#E3E3E3"><textarea name="comment" cols="40" rows="5" class="textarea" id="comment"></textarea> </td>
</tr>
<tr class="tdbg">
<td height="22" align="center" bgcolor="#C0C0C0"> </td>
<td height="22" align="center" bgcolor="#E3E3E3"> <div align="left">
<input name="Action" type="hidden" id="Action" value="Add">
<input name="Add" type="submit" class="textbotton1" value=" 添 加 ">
</div></td>
</tr>
</form>
</table>
<%
end if
%>
系统提示:Microsoft JET Database Engine 错误 '80040e21'
由于将在索引、 主关键字、或关系中创建重复的值,请求对表的改变没有成功。 改变该字段中的或包含重复数据的字段中的数据,删除索引或重新定义索引以允许重复的值并再试一次。
/back/admin/Products/ClassAddSmall.asp,行 36