<!--#include file="conn.asp"-->
<%
if session("admin")="" then
	Response.Redirect("index.asp?err=4")	
end if
%>
<%
if request.QueryString("type")="add" then
SqlAdd="INSERT INTO videotype ([name],[xuhao]) VALUES ('"&trim(request.Form("name"))&"',"&trim(request.Form("xuhao"))&")"
conn.execute(sqlAdd)
response.Redirect("?")
end if
if request.QueryString("type")="update" then
sqlUpdate="update videotype set [name]='"&trim(request.Form("name"))&"',[xuhao]="&trim(request.Form("xuhao"))&" where [id]="&request.QueryString("id")
conn.execute(sqlUpdate)
response.Redirect("?")
end if
if request.QueryString("type")="delete" then
sqlUpdate="delete from videotype where [id]="&request.QueryString("id")
conn.execute(sqlUpdate)
response.Redirect("?")
end if
%>
<!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=utf-8" />
<title>视频类别管理</title>
<link rel="stylesheet" type="text/css" href="css.css" />
</head>
<body>
<h4>视频类别管理&nbsp;&nbsp;<a href="videoAdmin.asp">返回视频中心</a></h4>
<form action="?type=add" method="post">视频类别添加：<input type="text" name="name" /> 序号：<input name="xuhao" type="text" value="0" size="3" />
&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value=" 添 加 " />
</form>
<h4>视频类别信息</h4> 
<table border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC" width="95%">
<tr bgcolor="#FFFFFF">
<td><strong>类别名称</strong></td><td><strong>编号</strong></td>
<td><strong>操作</strong></td>
</tr>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from videotype order by [xuhao] asc"
rs.open sql,conn,1,1
do while not rs.eof
%>
<form action="?type=update&id=<%=rs("id")%>" method="post"><tr bgcolor="#FFFFFF"><td><input name="name" type="text" value="<%=rs("name")%>" size="40" /></td><td><input name="xuhao" type="text" value="<%=rs("xuhao")%>" size="3" /></td><td><input type="submit" value=" 编 辑 " />　<a href="?type=delete&id=<%=rs("id")%>">删 除</a></td>
</tr></form>
<%
rs.movenext
loop
rs.close
%>
</table>
</body>
</html>
<%set conn=nothing%>
