Searching database

Results 1 to 2 of 2

Thread: Searching database

  1. #1
    Join Date
    Dec 1969

    Default Searching database

    I am trying to set up a search engine using ASP and an Access database and hope someone can help me. It is a recipe database <BR><BR>On page 1, I have a text box that is &#060;input type=text <BR>name=search&#062;. The user can input chicken. Then it goes to the <BR>next page (results.asp) and I have the asp script on this page <BR>with the sql statement<BR><BR>This is my sql statement on the results page:<BR><BR>strq5="SELECT * "<BR>strq5= strq5 & " FROM recipefields, ingrediants "<BR>strq5 = strq5 & "WHERE category Like &#039%" & searchform & "%&#039 "<BR>objRS5.Open strq5<BR><BR>This is in the body:<BR><BR>&#060;% If objRS5.BOF and objRS5.EOF Then%&#062;<BR><BR>&#060;h4 align="center"&#062;We did not find a match!&#060;/h4&#062;<BR>&#060;%Else%&#062;<BR><BR><BR>&#060;%I f Not objRS5.BOF Then%&#062;<BR><BR>&#060;h4&#062;Here are the results of your search:&#060;/h4&#062;<BR><BR>&#060;% do while not objRS5.eof <BR><BR>response.write objRS5("RecipeName")%&#062; <BR><BR> &#060;% <BR>ObjRS5.movenext <BR>loop <BR><BR>End If<BR>End If <BR><BR>objRS5.Close<BR>Set objRS5 = Nothing<BR>Conn.close<BR>Set Conn = Nothing<BR><BR>%&#062;<BR><BR>So what is happening is if they enter chicken, it pulls ALL of <BR>the recipe names (even if chicken is not an ingrediant) and it <BR>prints each recipe name like 3 times. Any suggestions?? <BR><BR>Thanks,Sarah

  2. #2
    Jerry E Guest

    Default RE: Searching database

    searchform is probably blank. You can check POST/GET method of <BR>Forms and request.querystring/request.form options for getting<BR>data from one form to another. You are also returning multiple rows because you are not joining any fields from the 2 tables.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts