请教——关于表单镶套的问题
有如图示一个产品修改查询页面:页面代码:
程序代码:
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.> <%@Language="VBScript" CodePage="65001"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>产品添加</title> </head> <% dim conn dim connstr Connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("dbdate/zswap.mdb") Set conn = Server.CreateObject("ADODB.Connection") Conn.Open Connstr %> <body> <form id="search" name="search" method="post" action="ts1.asp" target="_parent"> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="50"><div align="center">序号</div></td> <td width="250"><div align="center">产品编码</div></td> <td><div align="center">产品类名</div></td> <td width="50"><div align="center">查询</div></td> </tr> <tr> <td> </td> <td> <div align="center"> <input name="searchtxt" type="text" id="searchtxt" size="30" /> </div></td> <td><div align="center"> <input type="submit" name="searchgo" id="searchgo" value="搜索" /> </div></td> <td> </td> </tr> <% set rs=server.createobject("adodb.recordset") if request("searchtxt")<>"" then sql="select * from pro where cpid = '"&request("searchtxt")&"' order by id desc" else sql="select top 5 * from pro order by id desc" end if rs.open sql,conn,1,1 if rs.eof and rs.bof then response.write " <script language=""javascript"">alert(""请核对产品编码!"")</script>" end if %> <% do while not rs.eof %> <form id="chaxun" name="chaxun" method="post" action="ts1.asp" target="_parent"> <tr> <td><div align="center"><%=rs("id")%></div></td> <td><div align="center"><%=rs("cpid")%></div></td> <td><div align="center"><%=rs("cpname")%></div></td> <td><div align="center"> <input type="submit" name="chaxun" id="chaxun" value="查询" /> </div></td> </tr> <% set rs2=server.createobject("adodb.recordset") sql2="select * from pro where id= "&rs("id")&" " rs2.open sql2,conn,1,1 %> </form> <% rs.movenext loop rs.close %> </table> </form> <form name="form1" method="post" action="ts2.asp" target="_parent"> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="90"><div align="right">产品编号: </div></td> <td colspan="2"><input name="cpid" type="text" id="cpid" value="<%=rs2("cpid")%>"></td> <td width="50%"><font color="#FF0000"> * </font><font color="#999999">如:PACD1020 </font></td> </tr> <tr> <td><div align="right">产品名称: </div></td> <td colspan="2"><input name="cpname" type="text" id="cpname" value="<%=rs2("cpname")%>"></td> <td><font color="#FF0000">* </font><font color="#999999">如:亚克力珠</font></td> </tr> <tr> <td><div align="right">产品大类: </div></td> <td colspan="2"><input name="bigclass" type="text" id="bigclass" value="<%=rs2("bigclass")%>"></td> <td><font color="#FF0000">* </font><font color="#999999">两类:1,亚克力sb1s;2,LED灯sb2s</font></td> </tr> <tr> <td><div align="right">产品小类: </div></td> <td colspan="2"><input name="smallclass" type="text" id="smallclass" value="<%=rs2("smallclass")%>"></td> <td><font color="#FF0000">*</font><font color="#999999"> 如:亚克力珠,s11s</font></td> </tr> <tr> <td><div align="right">图片地址: </div></td> <td colspan="2"><input name="pic" type="text" id="pic" value="<%=rs2("pic")%>"></td> <td><font color="#FF0000">*</font><font color="#999999"> 如:img/pccd0120.jpg</font></td> </tr> <tr> <td><div align="right">产品规格: </div></td> <td colspan="2"><input name="size" type="text" id="size" value="<%=rs2("size")%>"></td> <td><font color="#999999">如:20*25*10 单位:mm</font></td> </tr> <tr> <td><div align="right">详细资料:</div></td> <td height="50" colspan="3"><textarea name="note" cols="50" rows="5" id="note"><%=rs2("note")%></textarea> <font color="#FF0000">*</font></td> </tr> <tr> <td><div align="right">验证码:</div></td> <td width="131"> <input name="CheckCode" size="6" maxlength="4" style="border-style:solid;border-width:1;padding-left:4;padding-right:4;padding-top:1;padding-bottom:1" onmouseover="this.style.background='#E1F4EE';" onmouseout="this.style.background='#FFFFFF'" onfocus="this.select(); " /> <img src="checkcode.asp" alt="" /><font color="#FF0000">*</font></td> <td width="65"><input type="submit" name="up" id="up" value="提交" /></td> <td> </td> </tr> </table> </form> </body> </html>目前的问题是,当没有查询关键词时,不能点击列出的查询按钮查询该ID产品,当查询无结果时,RS2(“ID”)无返回而报错
请教解决办法