Search Form Problems

Results 1 to 2 of 2

Thread: Search Form Problems

  1. #1
    Join Date
    Dec 1969

    Default Search Form Problems

    Hey everyone I am having trouble with a search function that I am trying to set-up. Here is the link to it: The products that I currently have in the database for testing purposes are Brand: Nike just use the brand nothing else. As you can see if you input a brand you get the message that nothing can be found. But now try it without the brand and the products from the database come up. Now I must of did something backwards along the line. Can you guys check out my code below. Thank You.<BR><BR><BR><BR>Search Results for &#060;% Response.Write Request.Form("Brand") %&#062;<BR><BR><BR><BR><BR>&#060;%<BR><BR><BR>Se t Conn = Server.CreateObject("ADODB.Connection")<BR>Conn.Pr ovider = "Microsoft.Jet.OLEDB.4.0"<BR>Conn.ConnectionSt ring = "Data Source=" & Server.MapPath ("db1.mdb")<BR>Set Rs = Server.CreateObject("ADODB.Recordset")<BR>Conn.Ope n<BR><BR><BR><BR>dim SQL<BR>SQL = "SELECT * from Products where Model like " & "&#039;%" & Request.Form("Brand") & "%&#039;"<BR><BR><BR> Rs.Open SQL, conn, 1,3 <BR> <BR>If ((rs.eof)) Then<BR>Response.Write "Sorry No Shoes Match Your Selection"<BR>Else<BR><BR>do while not rs.eof<BR><BR>Response.Write ""& rs ("Brand") & rs ("Model") & rs ("Sku") &"<BR>" <BR>rs.MoveNext &#039; Movenext<BR>loop<BR>set Rs = nothing<BR>set Conn = nothing<BR><BR>End If<BR>%&#062;<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Search Form Problems

    Since this is an Access DB, try using * instead of % as the wildcard character.<BR><BR>"SELECT * from Products where Model like &#039;*" & Request.Form("Brand") & "*&#039;"<BR><BR>

Posting Permissions

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