Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    hi folks,

    I have found a script which enables me to search my mp3 db (soon my midi db
    which I will post on the web) but I am having trouble because I am a
    complete and utter newbie, way over my head.

    I am coming to asp having designed static personal web sites for a few years
    and wanting to make them interactive.

    My particular problem might be easy for one of you folks to solve, but I
    have spent two days scouring the web and this newsgroup (amongst others)
    without finding a solution for my wee problem.

    Yes I found the page and script on the web (here
    [url]http://www.aspalliance.com/aspxtreme/ado/lettinguserssearchforinformation.aspx[/url]),
    but I have tried to adapt it so I can search from a chosen cloumn instead of
    just the one used in the original script. I have added a drop down list,
    from which I would like to select the column to search within, and have
    found a bit of script which I was hoping would resolve my problem, but alas,
    all it has done is given me a headache.

    Would someone please look at it and give me an idea how I would be able to
    do what I need to do?

    This is the complete page below (with the bits I have added to it) the
    orignial is here
    [url]http://www.aspalliance.com/aspxtreme/ado/lettinguserssearchforinformation.aspx[/url].

    THE PARTS I HAVE TRIED TO ADAPT ARE LABELLED <!-- MY BIT -->

    IF YOU WANT YOU CAN EMAIL ME AT [email]tuffallover@hotmail.com[/email]
    ---------------------------------------------------------------------------


    <%@ language="VBScript" %>

    <html>
    <head>
    <title>Music Database</title>

    <!-- 2000 ASPXtreme Web WorkShop; Author: Rey V. Nunez -->

    <link rel="stylesheet" type="text/css"
    href="http://127.0.0.1/abraxus/css/ip005.css"/>
    </head>

    <body>

    <div class="header"><h3>ADO Primer: Searching for Records Using <span
    class="hilite">SQL Select</span></h3></div>

    <hr size=1 width=90%>

    <div align="center">

    <% 'create a recordset object
    set adoCon=Server.CreateObject("ADODB.Recordset")
    rowCount=0 %>

    <form method="post">

    <!-- Start MY BIT -->
    <!-- This is the dropdown box whos column OPTIONS I want to use. -->
    <select name="clmname">
    <option value="Location">Location</option>
    <option value="FileName">FileName</option>
    <option value="CD">CD</option>

    <!-- END MY BIT -->
    Search for <input name="fldSearch"> <input type="submit" value="Find me">

    </form>

    <% if Request.Form("fldSearch")<>"" then
    strSearch=Request("fldSearch") %>

    <%

    <!-- Start MY BIT -->
    <!-- This is script for the dropdown box whos column OPTION I want to
    use.-->

    IF request.form("clmname") = "Location" THEN
    strclmname="Location"

    ELSEIF request.form("clmname") = "FileName" THEN
    strclmname="FileName"

    ELSEIF request.form("clmname") = "CD" THEN
    strclmname="CD"
    END IF
    <!-- END MY BIT -->
    %>

    <h5>. . . searching records from the tbl_MP3 Table where Product
    Description contains "<%= strSearch %>" </h5>
    <% 'specify the provider
    strProvider="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
    Server.MapPath("MP3.mdb")

    'Original search query
    strQuery = "SELECT Location, FileName, CD FROM tbl_MP3 WHERE FileName
    LIKE '%" & strSearch & "%'"

    <!-- Start MY BIT -->
    <!-- This is my version of the query -->
    strQuery = "SELECT Location, FileName, CD FROM tbl_MP3 WHERE" &
    strclmname & "LIKE '%" & strSearch & "%' ORDER BY FileName"

    <!-- WHAT AM I DOING WRONG PLEASE-->
    <!-- END MY BIT -->

    'open the search results recordset
    adoCon.Open strQuery, strProvider, , , adCmdText %>

    <table width=90% cellspacing=1 cellpadding=5 border=0>
    <!-- begin column headers for tbl_MP3 table -->
    <tr>
    <th width="30%">Folder</th>
    <th width="60%">File Name</th>
    <th width="10%">CD</th>
    <% if not adoCon.EOF then %>
    <% 'cycle thru the record set and display each row results
    do until adoCon.EOF %>
    <tr>
    <td><%= adoCon("Location")%></td>
    <td><%= adoCon("FileName")%></td>
    <td><%= adoCon("CD")%></td>
    <!-- next Row = next Record -->
    <% rowCount = rowCount+1
    'increment record position with MoveNext method
    adoCon.MoveNext
    loop
    else %>
    <td colspan=4 align="center"><h4>Sorry, no matches
    found.</h4></td></tr>
    <% end if %>
    </table>
    <% if rowCount>10 then %>
    <p><a href="#">Go Top</a></p>
    <% else %>
    <% end if
    'close tbl_MP3 recset and flush from memory
    adoCon.Close
    set adoCon = Nothing
    end if %>
    </div>

    <% if not isEmpty(Request.Form) then %>
    <br>
    <hr size=1 width=90%>


    <% end if %>

    </body>
    </html>



    gozilla Guest

  2. Similar Questions and Discussions

    1. newbie needing help
      Guys, I've been learning for two weeks now, so bear with me :-) I'd like to know how to echo a formatted table using the results from three...
    2. Form Field Highlights Remain in Print!?
      I cannot figure out how to eliminate the form field highlights that appear automatically in a .pdf form (an INS form offered on the Internet) from...
    3. I need a search field badly
      I would like to create a search field so that visitors can search for a page containing a particular word or item. What is an easy way to do this....
    4. Newbie can't get date range search from form to work
      Please help! I'm banging my head against a wall here. This is my first stab at ASP. I'm able to pass vars from a form to a search results page...
    5. Absolute Newbie Questions
      On Wed, 25 Jun 2003 21:54:25 +0000, Kent Wormsdorf wrote: Thanks for the info, unfortunately the past few hours searching desperately on the...
  3. #2

    Default Re: Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    Instead of posting 100 lines of code and html tags, tell us what result you
    are trying to get that you are not getting, and only include relevant code
    snippets.

    Ray at home

    --
    Will trade ASP help for SQL Server help


    "gozilla" <godzilla@godzilla.com> wrote in message
    news:vjj0peiusi1h6f@corp.supernews.com...
    > hi folks,
    >
    > I have found a script which enables me to search my mp3 db (soon my midi
    db
    > which I will post on the web) but I
    <TRIM>


    Ray at Guest

  4. #3

    Default Re: Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    > I get the feeling people just go through these groups and moan without
    > actually reading the post, <cough>Ray..
    Well, I happen to agree with Ray on this one. If you'd rather we ignore
    such posts, that's fine too. But it'd also be nice to help the user
    understand that they need to post more information than "this script is
    broken" and attach their entire script. We're not mind-readers, and to help
    the most amount of people, we can't be inspecting every line of code (as you
    must have to spot the typo) for potential problems...


    Aaron Bertrand - MVP Guest

  5. #4

    Default Re: Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    >No, I read them all. Usenet is about teaching people how to help
    >themselves, and the first step is learning how to explain a problem that you
    >can't get over. (This is not a jab at the OP. I'm sure my first usenet
    >posts were the same way, as were everyone else's.)
    Me Too! :)

    Jeff
    Jeff Cochran Guest

  6. #5

    Default Re: Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    Damn!

    Okay, most people's or some people's. :]

    Ray at work

    "Jeff Cochran" <jcochran.nospam@naplesgov.com> wrote in message
    news:3f3a8ecc.22701462@news.easynews.com...
    > >No, I read them all. Usenet is about teaching people how to help
    > >themselves, and the first step is learning how to explain a problem that
    you
    > >can't get over. (This is not a jab at the OP. I'm sure my first usenet
    > >posts were the same way, as were everyone else's.)
    >
    > Me Too! :)
    >
    > Jeff

    Ray at Guest

  7. #6

    Default Re: Absolute Newbie having problems with ASP search form and badly needing HELP if I am to remain SANE

    I see what you're all saying, I just thought the reply was a bit abrupt
    seeing as he did explain what he was trying to achieve and pointed out
    almost exactly which part of the code he was having trouble with.

    Anyway enough of this chatter, what I really want to know is if the code
    works now!

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Daniel Whiting Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139