Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Page with Search - How do I expand the search??

Status
Not open for further replies.

ladyck3

Technical User
Jan 3, 2003
800
US
I hope this is the right forum, if not, please direct me to where I need to be.

I just uploaded a database to the internet and I have an asp page for users to search.... but the search that is used on this ASP page allows the user to only search one word. This ASP page was borrowed (with permission) and I simply changed the fields 'n things to make it work... I don't know ASP or the coding... I have knowledge enough to see what is there and to manipulate it somewhat.

The author of this original resource is not knowledgeable enough to help me to expand this search feature so I need help PLEASE. To read a book is frivolous, it just won't sink in, I need help, like Beginner 99, not as high as 101.

The page/code can be found at
What do I need? How do I make this search field have the capability of searching for more than one word at a time. This is an index of out of print magazines on crafts. A user can enter the word "rug" and find all of the entries that have RUG in them.... but what if they want to look for "knit rug" they can't... Knit will pull up bazillions of things and "rug" much fewer but there's no way to pull up just "knit rugs"

Please help me to understand what I need to do to beef up this search mechanism. I'll beg if I have to :)

Ladyck3
LadyCK3
aka: Laurie :)


LadyCK3
aka: Laurie :)
 
I've figured out something, please tell me where I can improve. My code is as follows:

strQueryTotal = "SELECT Count(wb_db_tbl.WB_ID) AS CountOfWB_ID FROM wb_db_tbl;"


objRSsearch.open strQuery, objConn
objRSsearch1.open strQuery, objConn
objRStotal.open strQueryTotal, objConn

set objRSsearch = objConn.Execute (strQuery)
%>


I added two more lines for set objRSsearch and now I can search up to 3 words, but they must be together.

strQueryTotal = "SELECT Count(wb_db_tbl.WB_ID) AS CountOfWB_ID FROM wb_db_tbl;"


objRSsearch.open strQuery, objConn
objRSsearch1.open strQuery, objConn
objRStotal.open strQueryTotal, objConn

set objRSsearch = objConn.Execute (strQuery)
set objRSsearch = objConn.Execute (strQuery)
set objRSsearch = objConn.Execute (strQuery)
%>


So here's what I have... with just one line, it will search all fields and pull up ANYTHING in the database that meets a one word search.... if I add the two more lines, it will show something with up to 3 search criteria, as long as they are all part of the same field... such as Crochet Rug, it pulled up two records but here are others in the database, just those two have Crochet Rug in the same field.

So how do I change this so each of the three rows of code will search all fields regardless???

Hey, I found that much out, gimme a lil credit :)

Ladyck3


LadyCK3
aka: Laurie :)
 
it sounds like your trying to do some sort of relevance test. So if the user enters "Knit Rug" then they get all the results with both words first, then all the results with only word. Is this correct?

Couple of questions:
1) What type of database are you using? (Access MDB file, MS SQL Server, MySQL, etc)
2) What does your table structure look like? Could you post your initial query (you have the total one but that doesn't tell me much)

Thanks,
-T

 
I want to apologize for my lack of response today. I am SO FRUSTRATED, this site is not blocked from work. I use IE7 on Vista here at home, and was running IE6 on XPSP2 until yesterday at work when I updated to IE7. I am unable to hit this site now. Other's can even with IE7 but I cant. I even backed down to Ie6 again and still cant. I know it has to be some stupid setting somewhere but I have no idea where.

I really do apologize for what may have seemed like my lack of interest. I can assure you that is not the case.

Tarwn, in answser to your questions.
1. MS Access, its a catalog of magazine issues with fields as follows: Volume, Issue, Pages, Pattern_Pg, Pattern_Name, Craft, Category, Item

2. I seriously don't know what part of the code to post so will throw it in as follows and apologize for all the stuff.... please tell me which section you were referring to.... also you can see the page at

IF this is bad protocol here folks, I sincerely apologize...

Oh and someone said use SQL Code, can you do that in ASP code? I'm telling you, I am totally ignorant about this, but this IS working by searching ALL of the database. I want someone to be able to search by pattern_Name AND/OR Craft

===============================================


<html>
<head>
<title>Workbasket Lookup</title>






<link href="../css_files/main_css_lk.css" rel="stylesheet" type="text/css">
</head>


<body>

<table width="100%" height="100%" bgcolor="#336677">
<tr>

<td align="center">
<table width="98%" height="675" border="1" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF" class="common_link">

<tr>

<td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0" bordercolor="#999999"><br>



<tr>

<td align="center">
<h1>
Workbasket Lookup</h1><br>
<p><span class="important_info">Enter any word to show all records that meet your search criteria.<br>Type a % symbol to view all records.</span></p>
<p><strong>Added Records </strong><br>
3/26 to 3/28, 2007 (2302 to 2849) <br>
</p>
<span class="formselect">2849 Records<br>
<br></span>


<script language="JavaScript">
<!--

// Start hit counter code for YourHitStats.com
var data = '&r=' + escape(document.referrer)
+ '&n=' + escape(navigator.userAgent)
+ '&p=' + escape(navigator.userAgent)
+ '&g=' + escape(document.location.href);

if (navigator.userAgent.substring(0,1)>'3')
data = data + '&sd=' + screen.colorDepth
+ '&sw=' + escape(screen.width+'x'+screen.height);

document.write('<a href=" target=\"_blank\" >');
document.write('<img border=0 hspace=0 '+'vspace=0 src=" + data + '">');
document.write('</a>');
// End hit counter code for YourHitStats.com

// -->
</script>


<form action="/data/workbasket.asp" method="get">
<table>
<tr>
<td align="center"><input name="search" value=""></td><tr>
<td align="center"><input name="image" type="image" src="../workbasket/btn_search.jpg" WIDTH="78" HEIGHT="23" >
<br><br>
<!-- Turning off Export List to html for the time being
<a href="acc_db_xprt_xls.asp"><img src="images/btn_xls_exp.gif" width="120" height="23" border="0"></a></td>
-->
</tr>
</table>
</form>
<br>
<table width="100%" border="1" valign="top" align="center" cellpadding="0" cellspacing="0">
<tr class="formselect">
<th class="formselect">Volume</th>
<th class="formselect">Issue</th>
<th class="formselect">Trnsfr</th>
<th class="formselect">Month</th>
<th class="formselect">Year</th>
<th class="formselect">Pages</th>
<th class="formselect">Pattern_Pg</th>
<th class="formselect">Pattern_Name</th>
<th class="formselect">Craft</th>
<th class="formselect">Category</th>
<th class="formselect">Item</th>

</tr>








<!-- rem this section

<div align="center"><p><a href="active_form.asp"><img src="Images/btn_add.jpg" width="120" height="30" border="0"></a><a href="active_inventory_search_inv_update.asp"><img src="Images/btn_update.jpg" width="120" height="30" border="0"></a><a href="active_inventory_search_inv_delete.asp" target="_parent"><img src="Images/btn_delete.jpg" width="120" height="30" border="0"></a><a href="active_name_form.asp" target="_parent"><img src="Images/btn_add_name.jpg" width="120" height="30" border="0"></a><a href="active_inventory_cost_code_add.asp"><img src="Images/btn_add_Cost_Code.jpg" width="120" height="30" border="0"></a></p>
</div><br>
--- end rem this section of Mike's Buttons -->
</p>
<p>&nbsp; </p>
</body>
</html>


Thank you!!


LadyCK3
aka: Laurie :)
 
Well, the site has been having difficulties on-and-off for the past few days, so maybe you ran into one of the problem times. Don't worry, i've seen people ask questions and not follow up on them for over a week :)

Posting code is not bad form, however for future use you can use the [ignore]
Code:
[/ignore] tags around your code and it will be placed in a little code box that makes it easier to read.

When it comes to doing SQL queries your not really putting SQL code inside ASP, your just building a query or command string and then sending that to the database. In this case your building a SQL query:

"SELECT Count(wb_db_tbl.WB_ID) AS CountOfWB_ID FROM wb_db_tbl;"
"Please give me the number of times this id shows in the given table"

Back to the searching.

I'm still a little confused about what the code is doing. I believe the page in question is the search page: "../workbasket/btn_search.jpg"

I don't know how it is actually handling the search (the SQL query) or where the query from your earlier posts enters into it (that should be just counting the number of records in the table, not searching for anything).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top