编辑不能实现,郁闷!
lgyqd 2005-11-03 02:39:00 我想实现双重条件下的编辑功能。源代码如下:
请大家帮忙修改!
<% set rs=server.CreateObject("adodb.recordset")%>
<%if request("edit")="修改" then%>
<tr height=20>
<td>
</td>
</tr>
<%if request("edit3")="修改" then
id=Cint(request("id"))
zzm=trim(request("zzm"))
zpm=trim(request("zpm"))
kehu=trim(request("kehu"))
fxf=trim(request("fxf"))
slf=trim(request("slf"))
fanhao=trim(request("fanhao"))
if zzm="" then
response.Write "<script>alert('装置名不能为空!');window.navigate('sous_view.asp?edit=修改&id="&id&"&edit3=修改');</script>"
end if
if zzm=rs("zzm") then
response.Write"<script>alert('已有此装置名!');window.navigate('sous_view.asp?edit=修改&id="&id&"&edit3=修改');</script>"
else
sql="select * from project where id="&id
rs.Open sql,conn,1,3
rs("zzm")=zzm
rs("zpm")=zpm
rs("kehu")=kehu
rs("fxf")=fxf
rs("slf")=slf
rs("fanhao")=fanhao
rs.Update
response.Write"<script>alert('修改成功!');window.navigate('sous_view.asp?edit=修改');</script>"
end if
%>
<%if request("edit2")="修改" then
id=Cint(request("id"))
sql="select * from project where id="&id
rs.Open sql,conn,1,3
%>
<tr>
<td>
<table align=center border=1 ID="Table2">
<tr><td>装置名:<p align=center><input type=text name=zzm value="<%=rs("zzm")%>" ID="Text1"></p></td></tr>
<tr><td>制品名<p align=center><input type=text name=zpm value="<%=rs("zpm")%>" ID="Text2"></p></td></tr>
<tr><td>客户<p align=center><input type=text name=kehu value="<%=rs("kehu")%>" ID="Text3"></p></td></tr>
<tr><td>发行方<p align=center><input type=text name=fxf value="<%=rs("fxf")%>" ID="Text4"></p></td></tr>
<tr><td>受领方<p align=center><input type=text name=slf value="<%=rs("slf")%>" ID="Text5"></p></td></tr>
<tr><td>番号<p align=center><input type=text name=fanhao value=<%=rs("fanhao")%>" ID="Text6"></p></td></tr>
</table>
<%else%>
<table align=center border=1 bgcolor=#009933 ID="Table4">
<tr>
<td><p align=center>装置名</p></td>
<td><p align=center>制品名</p></td>
<td><p align=center>发行方</p></td>
<td><p align=center>受领方</p></td>
<td><p align=center>客户</p></td>
<td><p align=center>番号</p></td>
<td><p align=center>操作</p></td>
</tr>
<tr>
<% sql="select * from project"
rs.Open sql,conn,1,1
if rs.EOF then
response.Write"没有记录!"
else
for i=1 to rs.RecordCount
%>
<form action="sous_view.asp?edit=修改&id=<%=rs("id")%>" ID="Form4">
<td><p align=center><%=rs("zzm")%></p></td>
<td><p align=center><%=rs("zpm")%></p></td>
<td><p align=center><%=rs("fxf")%></p></td>
<td><p align=center><%=rs("slf")%></p></td>
<td><p align=center><%=rs("kehu")%></p></td>
<td><p align=center><%=rs("fanhao")%></p></td>
<td><p align=center><input type=submit name=edit2 value="修改" ID="Submit2"></p></td>
</tr>
<%rs.MoveNext%>
<%if rs.EOF then exit for%>
<%next%>
</table>
</td>
</tr>
<%end if
end if
%>