虾客们教小弟,如何利用按钮查询数据库种符合条件的记录?
真无语,一上午没人回帖?我真想知道高手去哪呢?请教个问题都这么难?无语了,我是菜,是很菜的那种。现在菜明白论坛里一般都是像我这样水的人居多,想遇到一两个稍微牛X一点得人还真难啊,哎 ,算了吧,刚刚注册的。不报什么鸟希望,管理员可以把帐号销掉!谢谢本人实属菜鸟,想修改一下别人做的一个简单的OA系统,但现在不知道如何利用按钮查询数据库种符合条件的记录,并分行显示出来。 <br>有三个文本框,故障日期,设备编号,用户,随便输入一个就可以查询出相应的记录,如果某一个为空,自动过滤。 <br>效果图见附件; <br>请大虾们教教我,在线等,急,谢谢! <br>代码如下: <br><table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> <br> <tr> <br> <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder5"> <br> <tr> <br> <td width="80" height="30" align="center" class="TableTitle1" ><strong> 设备编号</strong></td> <br> <td width="70" height="30" align="center" class="TableTitle1" ><strong> 用户</strong></td> <br> <td width="70" align="center" class="TableTitle1" ><strong>部门</strong></td> <br> <td width="79" align="center" class="TableTitle1" ><strong>故障日期</strong></td> <br> <td width="152" align="center" class="TableTitle1" style="font-weight: bold" >故障描述</td> <br> <td width="167" height="30" align="center" class="TableTitle1" ><strong>处理方法</strong></td> <br> <td width="132" align="center" class="TableTitle1" ><strong>详细情况</strong></td> <br> </tr> <br> <% <br> If(rs.Eof)Then <br> %> <br> <tr class="f_one"> <br> <td height="120" colspan="9" align="center">没有使用记录!</td> <br> </tr> <br> <% <br> else <br> repeat_rows = 0 <br> iii = 0 <br> While(repeat_rows < rs.PageSize and Not rs.Eof) <br> %> <br> <%baoxiu_id=rs("baoxiu_id")%> <br> <%if iii mod 2 = 0 then %> <br> <tr class="f_one"> <br> <%else%> <br> <tr class="f_two"> <br> <%end if%> <br> <%'<tr class="f_one" onMouseOver="this.className="f_two""onmouseout="this.className=f_one""> '%> <br> <td width="80" height="30" align="center"><%=rs("bx_id")%></td> <br> <td width="70" height="30" align="center"><%=rs("baoxiu_user")%></td> <br> <td width="70" height="30" align="center"><% set rs_s=server.CreateObject("adodb.recordset") <br> sql="select * from banji where id="&rs("baoxiu_banji")&" order by id" <br> rs_s.open sql,conn,1,1 <br> %> <br> <%=rs_s("bclassname")%> <br> <% <br> rs_s.close <br> set rs_s=nothing <br> %> <br> </td> <br> <td width="79" align="center"><%=rs("baoxiu_date")%></td> <br> <td width="152" align="center">第<%=rs("baoxiu_jieci")%>节</td> <br> <td width="167" height="30"><%=left(rs("baoxiu_neirong"),16)%></td> <br> <td width="132" align="center"><a href="baoxiu_list.asp?baoxiu_id=<%=baoxiu_id%>" title="点击浏览详情"> <br> <%if rs("baoxiu_zhuangtai") then%> <br> <span class="style2">正常</span> <br> <%else%> <br> <span class="style1">异常</span> <br> <%end if%> <br> </a></td> <br> </tr> <br> <% <br> repeat_rows = repeat_rows + 1 <br> iii = iii + 1 <br> rs.MoveNext <br> Wend <br> end if <br> %> <br> <br> <form name="form1" method="post" action=""> <br> <tr class="f_one" onMouseOver="this.className='f_two'"onMouseOut="this.className='f_one'"> <br> <td height="30" align="center" class="TableTitle1">查询过滤</td> <br> <td height="30" colspan="8" class="TableTitle1"> <br> <p> <br> <script language="javascript" src="js/time1.js"></script> <br> 故障日期: <br> <input type="text" name="baoxiu_date" readonly onClick="setDayHM(this);" /> <br> &nbsp; 设备编号 <br> <input type="text" name="bx_id" size="12" value="<%=request("bx_id")%>"> <br> &nbsp; 用 户 <br> <input type="text" name="baoxiu_user" size="12" value="<%=request("baoxiu_user")%>"> <br> <input type="submit" value="查找" name="find" > ----------------------------------------------------------------------------<b>这就是查找按钮,</b> <br> </select> <br> &nbsp;</p> <br> <p> 部门(自动跳转) <br> <select name="bj" id="bj" onChange="document.form1.submit();"> <br> <option value="" selected>全部</option> <br> <% <br> set rs_b=server.CreateObject("adodb.recordset") <br> sql="Select * from banji order by top" <br> rs_b.open sql,conn,1,1 <br> do while not rs_b.eof <br> %> <br> <option value="<%=rs_b("id")%>" <%if bj=cstr(rs_b("id")) then response.Write "selected"%>><%=rs_b("bclassname")%></option> <br> <% <br> rs_b.movenext <br> loop <br> rs_b.close <br> set rs_b=nothing <br> %> <br> </select> <br> <br> </p></td> <br> </tr> <br> </form> <br> </table>
[ 本帖最后由 arlysolm 于 2009-8-24 14:08 编辑 ]