求助!ASP关于同一表单多按钮或一个按钮的新增/修改操作
各位大虾,帮忙看看如题:现在可以新增但不能修改!!代码如下:<!--#INCLUDEFILE="system/conn.asp"--><html><head><metah...
各位大虾,帮忙看看 如题:现在可以新增 但不能修改!!
代码如下:
<!--#INCLUDE FILE="system/conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>职位管理</title>
<link rel=stylesheet type=text/css href="Skin/Default/Css.css">
<link rel=stylesheet type=text/css href="system/Style.css">
</head>
<%
dim add
Select Case request.querystring("act")
Case "add"
name_1=request.form("name_1")
win=request.form("win")
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from cs where name_1='"&name_1&"'"
rs.open sql,conn,1,3
rs.addnew
rs("name_1")=name_1
rs.update
rs.close
set rs=nothing
Case "edit"
name_1=request.form("name_1")
win=request.form("win")
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from cs where name_1='"&name_1&"'"
rs.open sql,conn,1,3
rs("name_1")=name_1
rs("win")=win
rs.update
rs.close
set rs=nothing
End Select
%>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<table width="100%" cellspacing=1 cellpadding=0 bgcolor="#CCCCCC">
<tr>
<td width="100%" bgcolor="FFFFFF">
<table width="100%" cellpadding="2" cellspacing="1" border="0"align="center">
<tr class=titletdbg>
<td height="23" class="Navigationtal" ><font color=FFFFFF>职务名称</font></td>
<td height="23" class="Navigationtal" width="360" >排序</td>
<td height="23" class="Navigationtal" width="120">操作</td>
</tr>
<form name="add" method="post" action="?act=add">
<tr class=titletdbg>
<td align="center" class="zttitle"><input type="text" name="name_1" size="30" value="<%=name_1%>"> </td>
<td align="center" class="zttitle"><input type="text" name="win" size="30" value="<%=win%>"></td>
<td align="center" class="zttitle">
<input type="submit" class="subt" value=" 保存 ">
<input type="submit" class="subt" value=" 更新 " onClick="?act=edit"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> 展开
代码如下:
<!--#INCLUDE FILE="system/conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>职位管理</title>
<link rel=stylesheet type=text/css href="Skin/Default/Css.css">
<link rel=stylesheet type=text/css href="system/Style.css">
</head>
<%
dim add
Select Case request.querystring("act")
Case "add"
name_1=request.form("name_1")
win=request.form("win")
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from cs where name_1='"&name_1&"'"
rs.open sql,conn,1,3
rs.addnew
rs("name_1")=name_1
rs.update
rs.close
set rs=nothing
Case "edit"
name_1=request.form("name_1")
win=request.form("win")
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from cs where name_1='"&name_1&"'"
rs.open sql,conn,1,3
rs("name_1")=name_1
rs("win")=win
rs.update
rs.close
set rs=nothing
End Select
%>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td valign="top">
<table width="100%" cellspacing=1 cellpadding=0 bgcolor="#CCCCCC">
<tr>
<td width="100%" bgcolor="FFFFFF">
<table width="100%" cellpadding="2" cellspacing="1" border="0"align="center">
<tr class=titletdbg>
<td height="23" class="Navigationtal" ><font color=FFFFFF>职务名称</font></td>
<td height="23" class="Navigationtal" width="360" >排序</td>
<td height="23" class="Navigationtal" width="120">操作</td>
</tr>
<form name="add" method="post" action="?act=add">
<tr class=titletdbg>
<td align="center" class="zttitle"><input type="text" name="name_1" size="30" value="<%=name_1%>"> </td>
<td align="center" class="zttitle"><input type="text" name="win" size="30" value="<%=win%>"></td>
<td align="center" class="zttitle">
<input type="submit" class="subt" value=" 保存 ">
<input type="submit" class="subt" value=" 更新 " onClick="?act=edit"></td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询