ASP查询页面问题,查询条件为下拉菜单
将查询页面做成了2个部分:一为查询条件输入页面,二为查询结果显示页面。1、查询页面,查询条件为下拉菜单,包含电话号码、新装标志、套餐类型、发展人四项,分别对应表的DHHM、XZBZ、TCLX、FZRY四个字段,下拉菜单选择字段后,在文本框输入查询的内容。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>查询资料</title>
<style type="text/css">
<!--
.STYLE3 {font-size: 18px}
.STYLE4 {
font-size: 36px;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form id="form2" name="form2" method="post" action="d_search.asp">
<p class="STYLE4">资料查询页面</p>
<hr />
<p> <span class="STYLE3">返回</span></p>
</form>
<form id="form1" name="form1" method="post" action="d_search.asp">
<span class="STYLE3"> 1、请选择要搜索的内容
<select name="chaxun" class="STYLE3" id="chaxun">
<option value="dhhm" selected="selected">电话号码</option>
<option value="xzbz">新装标志</option>
<option value="tclx">套餐类型</option>
<option value="fzry">发展人</option>
</select>
:
<input name="dhhm" type="text" class="STYLE3" id="dhhm" />
</span>
<input type="submit" name="Submit22" value="提交" />
</form>
<form id="form3" name="form3" method="post" action="">
</form>
<p> </p>
</body>
</html>
2、查询结果显示页面,在DW8中做了一个记录集,但是参数设置时“筛选”只能选一个字段,代码如下:Recordset1.Source = "SELECT * FROM test.yhsj WHERE dhhm = '" + Replace(Recordset1__MMColParam, "'", "''") + "'" ,问题是:查询页面选的不仅仅是电话号码,还有其他字段,因此无法查询到结果。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn1.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("dhhm") <> "") Then
Recordset1__MMColParam = Request.Form("dhhm")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn1_STRING
Recordset1.Source = "SELECT * FROM test.yhsj WHERE dhhm = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
-------