search problem

Results 1 to 2 of 2

Thread: search problem

  1. #1
    Join Date
    Dec 1969

    Default search problem

    Hi,<BR><BR>I&#039;m working on a small database search. I have one page with a<BR>textfield and 2 radiobuttons, one with the value title and the other with the value actor, and then I have another page with my asp code.<BR><BR>I want the user to be able to check a radio button so as to tell my code where to search, but it&#039;s not working instead it&#039;s dumping all the records on the page.<BR><BR>Here&#039;s my search code:<BR><BR>&#060;%<BR>Dim SearchText<BR>Dim choice<BR>SearchText = Request.Form("FilmSearch")<BR>choice = Request.Form("radiobutton")<BR><BR><BR>Set conn = Server.CreateObject("ADODB.Connection")<BR>conn.Op en "Cinema","",""<BR>Sql = "SELECT Film.* "<BR>Sql = Sql & "FROM Film "<BR>if choice = Title then<BR>Sql = Sql & "WHERE Film.Film LIKE &#039;%" & SearchText & "%&#039; "<BR>elseif choice = Actor then<BR>Sql = Sql & "WHERE Film.Actors LIKE &#039;%" & SearchText & "%&#039; "<BR><BR>end if<BR>response.write(SQL)<BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>rs.Open sql, conn<BR><BR>If not rs.EOF Then<BR><BR>%&#062;<BR><BR>Thanks for your help

  2. #2
    Join Date
    Dec 1969

    Default RE: search problem

    Do response.write on your choice variable to make sure that the results are infact being sent correctly to the ASP page. It would be my guess that the value it returns equals neither Title nor Actor.

Posting Permissions

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