<!--#include file="conn.asp"-->
<%set rs=server.createobject("adodb.recordset")
sql="select * from jtopic order by j_id desc"
rs.open sql,conn,1,1
%>
<script language="javascript">
function check1(i,o)
{
document.form.text2.value=i;
document.form.word2.value=o;
}
</script>
<form name="form" method="post" action="sort_in.asp">
<br><b> 专题类别:</b>
<input type="hidden" name="options" value=''>
<select name="jtop" id="jtop" onchange="check1(document.form.jtop.options[document.form.jtop.selectedIndex].lable,document.form.jtop.options[document.form.jtop.selectedIndex].title)">
<% do while not rs.eof %>
<option value="<%=rs("j_id")%>" lable="<%=rs("j_name")%>" title="<% =rs("j_flag") %>"><%=rs("j_name")%></option>
<%
rs.movenext
loop
%></select>
<input type="submit" name="Submit" value="删 除" onclick="form.options.value='del'"><p>
<input type="text" name="word1" size=57 value="" maxlength="50" style="width: 369; height: 22">
<input name="tui1" type="radio" id="tui" value="0" checked>默认<font color=red><b>0</b></font>
<input name="tui1" type="radio" id="tui" value="1">推荐<font color=red><b>1</b></font>
<input type="submit" name="Submit1" value="添 加" onclick="form.options.value='new'"> </p><p>
<input type="text" name="text2" size=57 value="" maxlength="50" style="width: 370; height: 22">
<input type="text" name="word2" size=57 value="" maxlength="50" style="width: 70; height: 23">
<input type="submit" name="Submit2" value="修 改" onclick="form.options.value='rename'"> </p>
</form>
+++++++++++ sort_in.asp +++++++++++++++++++++++++++++++++++
<!--#include file="conn.asp"-->
<%
dim cmdTemp
select case request.form("options")
case "rename"
on error resume next
Set cmdTemp = Server.CreateObject("ADODB.Command")
set rs=server.createobject("adodb.recordset")
cmdTemp.CommandText = "SELECT * FROM jtopic where j_id=" & request.form("jtop")
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
rs.Open cmdTemp, , 1, 3
if err.Number<>0 then
err.clear
response.write " <br>数 据 库 操 作 失 败 ! "
else
rs("j_name") = request.form("text2")
rs("j_flag") = request.form("word2")
rs.Update
rs.Close
set rs=nothing
set cmdTemp=nothing
finished
end if
case "del"
Rem 删除栏目 /. 注释或标记语句:Rem 格式:Rem [注释或标记](解释:可以当作标记供跳转语句使用,也可以当作脚本的注释使用)
on error resume next
sql="delete from jtopic where j_id=" & request.form("jtop")
conn.execute sql
if err.Number<>0 then
err.clear
response.write " <br>数 据 库 操 作 失 败 ! "
else
finished
end if
case "new"
on error resume next
Set cmdTemp = Server.CreateObject("ADODB.Command")
set rs=server.createobject("adodb.recordset")
cmdTemp.CommandText = "SELECT * FROM jtopic where (j_id IS NULL)"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = conn
rs.Open cmdTemp, , 1, 3
if err.Number<>0 then
err.clear
response.write " <br>数 据 库 操 作 失 败 ! "
else
rs.AddNew
rs("j_name") = request.form("word1")
rs("j_flag") = request.form("tui1")
rs.Update
rs.Close
set rs=nothing
set cmdTemp=nothing
finished
end if
end select
sub finished()
%>
<html>
<head><title>修改成功</title>
<meta http-equiv="refresh" content='0; URL=sort.asp'>
<link rel="stylesheet" href="css.css"></head>
<body>
<br><br><p align="center"><b>类别修改成功!</b></p><% end sub %>
本文地址:http://com.8s8s.com/it/it7852.htm