楼主看看下面的能不能派上用处。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/Coon.asp" -->
<%
Dim Rs
Dim Rs_numRows
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.ActiveConnection = MM_Coon_STRING
Rs.Source = "SELECT * FROM ClassBig ORDER BY M_id ASC"
Rs.CursorType = 0
Rs.CursorLocation = 2
Rs.LockType = 1
Rs.Open()
Rs_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Rs_numRows = Rs_numRows + Repeat1__numRows
%><!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>
</head>
<body>
<table width="750" border="0" cellspacing="0" cellpadding="2">
<tr>
<td height="25" colspan="2" background="../Images/bg1.gif"> 后台管理 >> 类别管理</td>
</tr>
<tr>
<td width="442">已有大类别:</td>
<td width="300">对应小类别</td>
</tr>
<tr>
<td valign="top"><table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#D2F6CF">
<tr>
<td align="center" bgcolor="#EDF7E7">名称</td>
<td align="center" bgcolor="#EDF7E7">序号</td>
<td align="center" bgcolor="#EDF7E7">管理</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT Rs.EOF))
%>
<tr>
<td align="center"><%=(Rs.Fields.Item("M_Name").Value)%></td>
<td align="center"><%=(Rs.Fields.Item("M_Order").Value)%></td>
<td align="center"><a href="TypeAdmin.asp?action=modify&id=<%=(Rs.Fields.Item("M_id").Value)%>">修改</a> | <a href="typeadmin.asp?del=yes&id=<%=(Rs.Fields.Item("M_id").Value)%>">删除</a></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Rs.MoveNext()
Wend
%>
</table>
<%
Rs.Close()
Set Rs = Nothing
%></td>
<td><IFRAME ID="Sm" src="TypeSmallView.asp?id=1" frameborder="0" scrolling="no" width="300" height="200"></IFRAME></td>
</tr>
<tr>
<td valign="top">
<%if request("action")="modify" then
id=request.querystring("id")
set rs=server.createobject("adodb.recordset")
sql1="select * from ClassBig where M_id= "&id
rs.open sql1,MM_Coon_STRING,1,1
%>
修改现有大类别:<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<form id="form1" name="form1" method="post" action="TypeAdmin.asp?go=yes&id=<%=rs("M_id")%>">
<tr>
<td>新名称</td>
<td>
<label for="textfield"></label>
<input name="TT" type="text" id="TT" value="<%=rs("M_Name")%>" />
<input type="submit" name="Submit" value="提交" id="Submit" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</form>
</table>
<%rs.close
set rs=Nothing
%>
<%end if %> </td>
<td>
<% if request("del")="yes" then
id=request.querystring("id")
set rs=server.createobject("adodb.recordset")
sql="select * from ClassBig where M_id="&id
rs.open sql,MM_Coon_STRING,1,3
rs.delete
rs.update
set rs=nothing
Response.redirect(request.servervariables("http_referer"))
end if
%>
<table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#D2F6CF">
<form id="form2" name="form2" method="post" action="typeadmin.asp?add=big">
<tr>
<td colspan="3" bgcolor="#EDF7E7">新增
大类别:</td>
</tr>
<tr>
<td align="center">名称</td>
<td align="center">序号</td>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><input name="BName" type="text" id="BName" size="10" /></td>
<td align="center"><input name="BCode" type="text" id="BCode" size="10" /></td>
<td align="center"> </td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="Submit22" value="提交" id="Submit2" /></td>
</tr> </form>
<tr>
<td colspan="3" bgcolor="#EDF7E7">新增小类别:
</td>
</tr>
<form id="form3" name="form3" method="post" action="typeadmin.asp?add=small">
<tr>
<td align="center">名称</td>
<td align="center">对应大类别序号</td>
<td align="center">小类别序号</td>
</tr>
<tr>
<td align="center"><label for="textfield"></label>
<input name="Snam" type="text" id="Snam" size="10" /></td>
<td align="center"><input name="SBcode" type="text" id="SBcode" size="10" /></td>
<td align="center"><input name="Scode" type="text" id="Scode" size="10" /></td>
</tr>
<tr>
<td colspan="3" align="center"><label for="label"></label>
<input type="submit" name="Submit2" value="提交" id="label" /></td>
</tr> </form>
</table></td>
</tr>
</table>
<%if request("add")="big" then
BName=request.form("BName")
BCode=request.form("BCode")
if BName="" or BCode="" then
response.write "<SCRIPT language=JavaScript>alert('Please write the txt , is not right now!');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
'检验类型名称,类型名称不能重复
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ClassBig where M_Name='"&LCase(trim(request.form("BName")))&"'" ,MM_Coon_STRING,1,1
if rs.recordcount>0 then
response.write "<script language=javascript>"
response.write "alert('Sorry, this type of the name is exist in the database now!');"
response.write "this.location.href='vbscript:history.back()';</script>"
Response.end
else
'检验类型编号,类型编号不能重复。
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ClassBig where M_Order="&BCode ,MM_Coon_STRING,1,1
if rs.recordcount>0 then
response.write "<script language=javascript>"
response.write "alert('Sorry, this Order of the id is exist in the database now!');"
response.write "this.location.href='vbscript:history.back()';</script>"
Response.end
else
set rs=server.createobject("adodb.recordset")
sql="select * from ClassBig "
rs.open sql,MM_Coon_STRING,1,3
rs.addnew
rs("M_Name")=BName
rs("M_Order")=BCode
rs.update
rs.close
set rs=nothing
Response.redirect(request.servervariables("http_referer"))
end if
end if
end if
%>
<%
if request("add")="small" then
BName=request.form("Snam")
BCode=request.form("SBcode")
SCode=request.form("SCode")
if BName="" or BCode="" then
response.write "<SCRIPT language=JavaScript>alert('Please write the txt , is not right now!');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
'检验类型名称,类型名称不能重复
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ClassSm where M_Title='"&LCase(trim(request.form("BName")))&"'" ,MM_Coon_STRING,1,1
if rs.recordcount>0 then
response.write "<script language=javascript>"
response.write "alert('Sorry, this type of the name is exist in the database now!');"
response.write "this.location.href='vbscript:history.back()';</script>"
Response.end
else
'检验类型编号,类型编号不能重复。
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from ClassSm where M_Class="&BCode ,MM_Coon_STRING,1,1
if rs.recordcount>0 then
response.write "<script language=javascript>"
response.write "alert('Sorry, this Order of the id is exist in the database now!');"
response.write "this.location.href='vbscript:history.back()';</script>"
Response.end
else
set rs=server.createobject("adodb.recordset")
sql="select * from ClassSm "
rs.open sql,MM_Coon_STRING,1,3
rs.addnew
rs("M_Title")=BName
rs("M_Big")=SBcode
rs("M_Class")=BCode
rs.update
rs.close
set rs=nothing
Response.redirect(request.servervariables("http_referer"))
end if
end if
end if
%>
</body>
</html>