请帮助Advanse Search,两部分正在工作,第三部分正在连接。 [英] Please Help Advanse Search, two parts are working, the 3rd to connect.

查看:77
本文介绍了请帮助Advanse Search,两部分正在工作,第三部分正在连接。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我的预先搜索工作有两部分工作,我的逻辑用完了

连接第三部分。我的思绪在摇摆! Pleaseeeeeeeee帮助我。


我有3个Fiels要搜索,前两个作品,那个:


1.从中搜索的类别(下拉名称:ASPDBCatSearch)正在工作

带有输入文本框字段(名称:关键字),基于无论什么选择

下拉值选择:

期权价值 FirstName,Title,Email等...通过asp代码连接到输入

文本框字段(名称:关键字):


'' HTML下拉名称| FirstName是值名称


如果Request.Form(" ASPDBCatSearch")=" FirstName"然后


''HTML输入文本框名称是关键字


SQL = SQL& " WHERE FirstName LIKE''%' &安培; Request.Form(" keyword")& "%''

"

结束如果


基于选择的其余值适用于关键字输入。< br>

Hi Everyone,

I got two parts of my advance search to work, I am running out of Logic to
connect the third. My mind is in swing! Pleaseeeeeeeee Help me.

I have 3 Fiels to search, the First two works, thats:

1. Category to search from the (Drop down name: ASPDBCatSearch) is working
with the Input Text Box Field (name: keyword), based on Whatever selection on
the Drop down value selection:
The "Option Value" FirstName,Title,Email etc... is connected to the Input
Text Box Field (name: keyword) with the asp code thus:

'' HTML Drop down Name | FirstName is the value name

If Request.Form("ASPDBCatSearch") = "FirstName" Then

'' HTML Input Text Box name is keyword

SQL = SQL & " WHERE FirstName LIKE ''%" & Request.Form("keyword") & "%''
"
End If

The rest values based on selection works with the Keyword typing.


>>>>我的问题是:我添加了另一个下拉呼叫薪水(姓名:Salarycom),我需要将其添加到Search Logic,我迷路了,我该怎么办呢?
>>>>My Question is: I have added another drop Down Call salary (name: Salarycom), I need to add that to the Search Logic, and I am lost, How can I do this please?



在Breiaf中如何连接薪资下拉值?到类别

搜索下拉+和输入文本框搜索以匹配精确搜索?


可以有人给我两个例句与我的例子上面添加了代码

如何将工资值添加到分类和输入txt框中?

字段在asp代码中?


----------------------------------------------- -------------------------------

html代码:

< table border =" 0"宽度= QUOT; 525" BGCOLOR = QUOT;#FFFFFF" cellspacing =" 3"

cellpadding =" 3"

style =" border:0px outset #EEEEEE; ">

< tr>

< td width =" 515" bgcolor =" #FFFFFF">< form action =" Searchengineresults.asp"

method =" post" align =" center">


< div align =" center">< center>

< table border =" 1 QUOT;宽度= QUOT; 486" cellpadding =" 3"

bgcolor ="#F5F5F5" bordercolorlight = QUOT;#EEEEEE" style =" border-collapse:

collapse">

< tr>

< td align =" left" width =" 169">< strong>< font face =" Tahoma">< big>< big>

< font size =" 1"> 1.< / font>< / big>< / big>< font size =" 1"选择一个类别以

搜索< / font>< / font>< / strong>< p align =" center">< select

name =" ASPDBCatSearch" size =" 1">

< option selected value =" All"> All< / option>

< option value =" FirstName" >名字< / option>

< option value =" LastName">姓氏< /选项>

< option value =" Title" ;>标题< /选项>

< option value =" Division"> Dept / Div< / option>

< option value =" ;电话">电话< /选项>

<选项值="电子邮件">电子邮件< /选项>

< / select> ;< / td>

< td align =" left"宽度= QUOT; 106" bgcolor ="#FF870F">< strong>< font

face =" Tahoma">< big>< big>

< font size =" 1"> 2.< / font>< / big>< / big>< font size =" 1">

Salary< / font> < / font>< / strong>< p>

< select name =" Salarycom" size =" 1">

< option selected value =" Allsal"> All< / option>

< option value =" 10000" > 10000< / option>

< option value =" 20000"> 20000< / option>

< option value =" 30000"> 30000< / option>

< option value =" 40000"> 30000< / option>

< option value =" 50000">" 50000< / option>

< option value =" 60000"> 60000< / option>

< option value =" 70000"> 70000< / option> ;

< option value =" 80000"> 80000< / option>

< option value =" 90000"> 90000< / option>


< option value =" 100000或Abv"> 100000或Abv< / option>


< / select>< / td>

< td width =" 172" align =" right">

< p align =" center">< strong>< font face =" Tahoma">< big>< big>

< font size =" 1"> 3.< / font>< / big>< / big>< font size =" 1"类型搜索
条件< / font>< / font>< / strong>< p>

< input type =" text"大小= QUOT; 30英寸; name =" keyword">< / td>

< / tr>

< tr>

< td colspan = QUOT; 3英寸对齐= QUOT;中心" width =" 478">

< p>< input type =" reset"命名= QUOT; B2" value =" Clear">

< input type =" submit"命名= QUOT; B1" value ="搜索员工">< / td>

< / tr>

< / table>

< / center>< / div>

< / form>

< / td>

< / tr>

< / table>

< / center>< / div>


< / body>

< / html>


------------------------------ ------------------------------------------------ <无线电通信$>
---------------------


ASP代码Searchengineresults.asp

<%@ LANGUAGE =" VBSCRIPT" %>

< html>

< head>

< title>搜索引擎结果!< / title>

< / head>


< body>

<%


昏暗的SQL


设置aspdbweb = Server.CreateObject(" ADODB.Connection")

aspdbweb =" Provider = Microsoft.Jet.OLEDB.4.0;数据来源= &安培; Server.MapPath

(" employees.mdb")& ""


SQL =" SELECT * FROM Employees"


''关于工资的示例下拉列表要连接到其余两个(类别

和输入文本框)请在此处赞赏

如果Request.Form(" ASPDBCatSearch")=" FirstName"然后

SQL = SQL& " WHERE FirstName LIKE''%' &安培; Request.Form(" keyword")& "%''"

结束如果


如果Request.Form(" ASPDBCatSearch")=" LastName"然后

SQL = SQL& " WHERE LastName LIKE''%' &安培; Request.Form(" keyword")& "%''"

结束如果


如果Request.Form(" ASPDBCatSearch")=" Title"然后

SQL = SQL& "标题LIKE''%' &安培; Request.Form(" keyword")& "%''"

结束如果


如果Request.Form(" ASPDBCatSearch")=" Division"然后

SQL = SQL& "分区LIKE''%' &安培; Request.Form(" keyword")& "%''"

结束如果


如果Request.Form(" ASPDBCatSearch")=" Phone"然后

SQL = SQL& "电话里面''%' &安培; Request.Form(" keyword")& "%''"

结束如果


如果Request.Form(" ASPDBCatSearch")=" Email"然后

SQL = SQL& " EMERE LIKE''%' &安培; Request.Form(" keyword")& "%''"

结束如果


设置rsglobal = Server.CreateObject(" ADODB.Recordset")

rsglobal.Open SQL,aspdbweb,3

%>

<%

如果rsglobal.BOF和rsglobal.EOF那么%> ;


< h2 align =" center">我们找不到匹配项!< / h2>

<%Else%> ;

<%如果不是rsglobal.BOF那么%>


< h2>以下是您的搜索结果:< / h2>


< table BORDER =" 0"宽度= QUOT; 100%QUOT; cellpadding =" 3">

< tr>

< th bgcolor ="#FF870F">< span style =" font-weight :400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1">名字< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style = " font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1">姓氏< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style = " font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1"> Salary< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style =" ; font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1"> Title< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style =" ; font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1"> Division< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style =" ; font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1">电话< / font>< / span>< / th>

< th bgcolor ="#FF870F">< span style =" ; font-weight:400">

< font face =" Arial"颜色= QUOT;#FFFFFF" size =" 1">电子邮件< / font>< / span>< / th>

< / tr>

<%

Do while not rsglobal.EOF

%>

< tr>

< td>< ;%= rsglobal(" FirstName")%>< / td>

< td><%= rsglobal(" LastName")%>< / td>

< td><%= rsglobal(" 1SalaryDB")%>< / td>

< td><%= rsglobal(""标题")%>< / td>

< td><%= rsglobal(" Division")%>< / td>

< td><%= rsglobal(" Phone")%>< / td>

< td>< a href =" mailto:<%= rsglobal( 电子邮件)%>"><%= rsglobal("电子邮件")%

In Breiaf How can I connect the "Salary Drop down Values" to the Category
Search drop down + and the Input txt box Search to match the Exact Search?

Can Some one Give me two sentences of example with my above Added code as to
how the salary values should be added to the Category and Input txt box
fields in the asp code?

------------------------------------------------------------------------------
The html Code:
<table border="0" width="525" bgcolor="#FFFFFF" cellspacing="3"
cellpadding="3"
style="border: 0px outset #EEEEEE; ">
<tr>
<td width="515" bgcolor="#FFFFFF"><form action="Searchengineresults.asp"
method="post" align="center">

<div align="center"><center>
<table border="1" width="486" cellpadding="3"
bgcolor="#F5F5F5" bordercolorlight="#EEEEEE" style="border-collapse:
collapse">
<tr>
<td align="left" width="169"><strong><font face="Tahoma"><big><big>
<font size="1">1.</font></big></big><font size="1"Select a category to
search</font></font></strong><p align="center"><select
name="ASPDBCatSearch" size="1">
<option selected value="All">All</option>
<option value="FirstName">First Name</option>
<option value="LastName">Last Name </option>
<option value="Title">Title </option>
<option value="Division">Dept/Div </option>
<option value="Phone">Phone </option>
<option value="Email">E-Mail </option>
</select></td>
<td align="left" width="106" bgcolor="#FF870F"><strong><font
face="Tahoma"><big><big>
<font size="1">2.</font></big></big><font size="1">
Salary</font></font></strong><p>
<select name="Salarycom" size="1">
<option selected value="Allsal">All</option>
<option value="10000">10000</option>
<option value="20000">20000</option>
<option value="30000">30000</option>
<option value="40000">30000</option>
<option value="50000">50000</option>
<option value="60000">60000</option>
<option value="70000">70000</option>
<option value="80000">80000</option>
<option value="90000">90000</option>

<option value="100000 or Abv">100000 or Abv</option>

</select></td>
<td width="172" align="right">
<p align="center"><strong><font face="Tahoma"><big><big>
<font size="1">3.</font></big></big><font size="1"Type search
criteria</font></font></strong><p>
<input type="text" size="30" name="keyword"></td>
</tr>
<tr>
<td colspan="3" align="center" width="478">
<p><input type="reset" name="B2" value="Clear">
<input type="submit" name="B1" value="Search employees"></td>
</tr>
</table>
</center></div>
</form>
</td>
</tr>
</table>
</center></div>

</body>
</html>

------------------------------------------------------------------------------
---------------------

ASP Code Searchengineresults.asp
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Search Engine Results!</title>
</head>

<body>
<%

Dim SQL

Set aspdbweb = Server.CreateObject("ADODB.Connection")
aspdbweb = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath
("employees.mdb") & ";"

SQL = "SELECT * FROM Employees"

'' An Example on Salary Drop down Values to connect to the rest two (Category
and Input txt Box) please here will be appreciated
If Request.Form("ASPDBCatSearch") = "FirstName" Then
SQL = SQL & " WHERE FirstName LIKE ''%" & Request.Form("keyword") & "%'' "
End If

If Request.Form("ASPDBCatSearch") = "LastName" Then
SQL = SQL & " WHERE LastName LIKE ''%" & Request.Form("keyword") & "%''"
End If

If Request.Form("ASPDBCatSearch") = "Title" Then
SQL = SQL & " WHERE Title LIKE ''%" & Request.Form("keyword") & "%''"
End If

If Request.Form("ASPDBCatSearch") = "Division" Then
SQL = SQL & " WHERE Division LIKE ''%" & Request.Form("keyword") & "%''"
End If

If Request.Form("ASPDBCatSearch") = "Phone" Then
SQL = SQL & " WHERE Phone LIKE ''%" & Request.Form("keyword") & "%''"
End If

If Request.Form("ASPDBCatSearch") = "Email" Then
SQL = SQL & " WHERE EMail LIKE ''%" & Request.Form("keyword") & "%''"
End If

Set rsglobal = Server.CreateObject("ADODB.Recordset")
rsglobal.Open SQL, aspdbweb, 3
%>
<%
If rsglobal.BOF and rsglobal.EOF Then%>

<h2 align="center">We did not find a match!</h2>
<%Else%>
<%If Not rsglobal.BOF Then%>

<h2>Here are the results of your search:</h2>

<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">First name </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Last Name </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Salary </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Title </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Division </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">Phone </font></span></th>
<th bgcolor="#FF870F"><span style="font-weight: 400">
<font face="Arial" color="#FFFFFF" size="1">E-Mail </font></span></th>
</tr>
<%
Do While Not rsglobal.EOF
%>
<tr>
<td><%=rsglobal("FirstName")%></td>
<td><%=rsglobal("LastName")%></td>
<td><%=rsglobal("1SalaryDB")%></td>
<td><%=rsglobal("Title")%></td>
<td><%=rsglobal("Division")%></td>
<td><%=rsglobal("Phone")%></td>
<td><a href="mailto:<%=rsglobal("Email")%>"><%=rsglobal(" Email")%


>< / a>< / TD>
></a></td>



< / tr>

<%rsglobal.MoveNext

Loop

%>

< / table>

<%End if%>

<%End If%>

<%

rsglobal.Close

%>

< / body>

< / html>


----------------------------- ---------------------------


等待您的好评。


谢谢。

</tr>
<% rsglobal.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsglobal.Close
%>
</body>
</html>

--------------------------------------------------------

Awaiting your favorable reply.

Thank you.

推荐答案

Old Pedant写道:

******** ***********
Old Pedant wrote:
*******************

>

*从不*打扰检查BOF。无意义。
>
*NEVER* bother checking BOF. Pointless.



....除非记录集中的导航已经发生,或者记录已从中删除了
。 :-)


如果您添加了 ......打开记录集后立即。我会

没有评论。

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。

.... unless navigation in the recordset has occurred, or records have
been deleted from it. :-)

If you had added " ... immediately after opening the recordset." I would
have had no comment.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


" Bob Barrows [MVP]"写道:
"Bob Barrows [MVP]" wrote:

如果您添加了 ......打开记录集后立即。我会

没有评论。
If you had added " ... immediately after opening the recordset." I would
have had no comment.



是的,我知道。但是在编写ASP代码的8年里(除了几个无偿的非营利组织网站之外,我不再做了b / b
)我从未有过一次

的理由使用或需要BOF测试。我认为例外非常罕见,

说永远不会比描述不会遇到的b / b
(实际上)不会遇到的例外情况要好得多。


哦......还有超过86,000个帖子我做了ASPMessageBoard网站,回答了各种各样的问题,从来没有任何人有任何需要

BOF测试的代码。 ( http://www.aspmessageboard.com/scripts/topPosters.asp

有时,即使对于一个老学生来说,当这种做法非常片面时,也不值得阐述这个理论。


很高兴认识一个比我更迂腐的人。 < grin />


p.s。:实际上,我给自己起了这个名字,因为我倾向于修改英语语法,而不是代码语法。 < grin style =" monstrous" />

Yah, I know. But in 8 years of writing ASP code (which I no longer do
except for a couple of pro bono non-profit org sites) I never once had a
reason to use or need a BOF test. I think the exceptions are so rare that
saying "never" is better than bothering to describe the exceptions that will
(in practice) not be encountered.

Oh...and in over 86,000 posts I made on the ASPMessageBoard site, answering
all sorts of questions, never once did anybody have any code that needed the
BOF test, either. ( http://www.aspmessageboard.com/scripts/topPosters.asp )

Sometimes, even for an old pedant, it''s not worth expounding the theory when
the practice is so overwhelmingly one-sided.

It''s nice to meet somebody even more pedantic than I am. <grin/>

p.s.: Actually, I gave myself that name because of my penchant for
correcting English syntax, not code syntax. <grin style="monstrous" />


Hello Bob Barrows和Old Pedant,


我非常感谢你的回复对于迟到的回复,我很抱歉,谢谢你们为了帮助有需要的人做出快速反应。我正在测试我的代码。


非常感谢Old Pedant。


Old Pedant写道:
Hello Bob Barrows, and Old Pedant,

I thank you so much for the response I am sorry for the late reply, and thank
you for the speedy response to help the needy. I am testing my code.

Thank you so much Old Pedant.

Old Pedant wrote:

>如果您添加了 ......打开记录集后立即。我会没有评论。
>If you had added " ... immediately after opening the recordset." I would
have had no comment.


呀,我知道。但是在编写ASP代码的8年中(除了几个无偿的非营利性组织网站之外我不再这样做)我从未有过使用或需要BOF测试的理由。我认为例外是如此罕见以至于说永远不会更好的是描述将不会遇到(在实践中)不会遇到的例外情况。

哦...我在ASPMessageBoard网站上发布的超过86,000个帖子,回答
各种各样的问题,从来没有任何人有任何需要
BOF测试的代码。 ( http://www.aspmessageboard.com/scripts/topPosters.asp

有时候,即使对于一个古老的学生来说,当这种做法如此片面地过分时,也不值得阐述理论。

很高兴认识一个比我更迂腐的人。 < grin />

p.s。:实际上,我给自己起了这个名字,因为我倾向于纠正英语语法,而不是代码语法。 < grin style =" monstrous" />


Yah, I know. But in 8 years of writing ASP code (which I no longer do
except for a couple of pro bono non-profit org sites) I never once had a
reason to use or need a BOF test. I think the exceptions are so rare that
saying "never" is better than bothering to describe the exceptions that will
(in practice) not be encountered.

Oh...and in over 86,000 posts I made on the ASPMessageBoard site, answering
all sorts of questions, never once did anybody have any code that needed the
BOF test, either. ( http://www.aspmessageboard.com/scripts/topPosters.asp )

Sometimes, even for an old pedant, it''s not worth expounding the theory when
the practice is so overwhelmingly one-sided.

It''s nice to meet somebody even more pedantic than I am. <grin/>

p.s.: Actually, I gave myself that name because of my penchant for
correcting English syntax, not code syntax. <grin style="monstrous" />



-

通过 http://www.webmasterkb.com

--
Message posted via http://www.webmasterkb.com


这篇关于请帮助Advanse Search,两部分正在工作,第三部分正在连接。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆