search library system in asp

Ask a Question related to ASP, Design and Development.

  1. #1

    Default search library system in asp

    Hi…

    I’m doing a search page form my work for their library. Since
    this is the first time I work with ASP I’m facing some problems.

    Each library item has different search data, I was able to build but
    I’m stuck at when the user chooses books for e.g it refreshes
    the page and the combo box goes to the first item.while I want it to
    stay on books.
    The second problem is that I need a code for displaying the specific
    table chosen by the user from the first combo.

    I’ve done it by an if statement but it didn’t work…
    This is the code I have come up with:



    <html>
    <body bgcolor="#FFFFFF" text="#000000" >

    <%

    Dim strURL
    Dim cnnSearch
    Dim rstSearch
    Dim strDBPath
    Dim strSQL
    Dim strSearch

    strURL = Request.ServerVariables("URL")

    strSearch = Request.QueryString("search")
    strSearch = Replace(strSearch, "'", "''")
    y=request("mymenu")

    %>

    <b>
    <form name="form1" method="get" action="test.asp">
    <font color="#32B0AF" size="2">
    Search in:
    </font>
    <select name="mymenu" onchange="document.form1.submit()">
    <option value="0" selected>---Select---</option>
    <option value="1">Book</option>
    <option value="2">Magazine</option>
    <option value="3">Legal Gazzete</option>
    <option value="4">Science Paper</option>
    <option value="5">Video</option>
    <option value="6">Clipping</option>
    </select>


    <% if y>0 then %>
    <font color="#32B0AF" size="2">
    Search By:
    </font>

    <%Select Case y
    Case "1"
    %>
    <select name="sub" >
    <option value="0" selected>---Select---</option>
    <option value="title">Title</option>
    <option value="author">Author</option>
    <option value="topic">Topic</option>
    <option value="keyword">Keyword</option>
    </select>

    <% Case "2"%>
    <select name="sub">
    <option value="0" selected>---Select---</option>
    <option value="name">Name</option>
    <option value="title">Title</option>
    </select>

    <% Case "3"%>
    <select name="sub">
    <option value="0" selected>---Select---</option>
    <option value="title">Title</option>
    </select>

    <% Case "4"%>
    <select name="sub">
    <option value="0" selected>---Select---</option>
    <option value="title">Title</option>
    <option value="author">Author</option>
    </select>

    <% Case "5" %>
    <select name="sub">
    <option value="0" selected>---Select---</option>
    <option value="title">Title Keyword</option>
    </select>


    <% Case "6" %>
    <select name="sub">
    <option value="0" selected>---Select---</option>
    <option value="title">Title Keyword</option>
    </select>
    <%Case Else

    End Select%>

    <input type="text" name="search">
    <input type="submit" value="Search">

    <% end if %>

    </p>

    <%
    If strSearch <> "" Then

    strDBPath = Server.MapPath("User Library system.bak")

    Set cnnSearch = Server.CreateObject("ADODB.Connection")

    cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Inetpub\wwwroot\User Library
    system.bak;" & _
    "Jet OLEDB:System
    Database=C:\Inetpub\wwwroot\Secured.mdw;", _
    "staff", "envr"

    'if(y=1) then
    strSQL = "SELECT bookid, title, topic " _
    & "FROM books " _
    & "WHERE title LIKE '%" & Replace(strSearch, "'", "''") & "%' order
    by bookid ;"
    'else if (y=2) then
    'strSQL = "SELECT magazineid,name,title " _
    '& "FROM Magazine " _
    '& "WHERE name LIKE '%" & Replace(strSearch, "'", "''") & "%'
    order by magazineid ;"
    'end if

    Set rstSearch = cnnSearch.Execute(strSQL)
    %>

    <table border="1">
    <TR><TH>Book Id</th> <th>Title</th> <th>Topic</th></tr>
    <%
    Do While Not rstSearch.EOF
    %>
    <tr>
    <td><%= rstSearch.Fields("bookid").Value %> </td>
    <td><%= rstSearch.Fields("title").Value %> </td>
    <td><%= rstSearch.Fields("topic").Value %> </td>
    </tr>
    <%
    rstSearch.MoveNext
    Loop
    %>
    </table>
    <%
    rstSearch.Close
    Set rstSearch = Nothing
    cnnSearch.Close
    Set cnnSearch = Nothing
    End If
    %>
    </body>
    </html>






    Thanxxxxx for ur help
    amoona Guest

  2. Similar Questions and Discussions

    1. In search of working IM library
      I provide information via email to several clients, and in many cases it would be better to use an instant messanger like MSN, Yahoo, or AIM. My...
    2. Error making a search system
      Hi all, this is a simple search system to lookup proyects that contains the words in the querystring "palabras", but when running the code I get...
    3. OT: card catalog system for public library?
      You should check the Koha libray system at www.koha.org Cheers On Thu, 24 Jul 2003, Henry House wrote:
    4. ~/Library/ vs ~/System/Library vs /User/Library/
      In article <110720031327074895%justin.c@se.net>, justin <justin.c@se.net> wrote: First off, you're a little bit confused. ~ means your home...
    5. [XFree86] system can't find library ( strange library behaviour )
      Hi Mark, No I hadn't tried ldconfig, but it sorted out the problem, thanks! I'd read a little bit about libraries a while ago, but could not...
  3. #2

    Default Re: search library system in asp

    amoona wrote:
    > ...
    > Each library item has different search data, I was able to build but
    > I’m stuck at when the user chooses books for e.g it refreshes
    > the page and the combo box goes to the first item.while I want it to
    > stay on books.
    Your script needs to capture the selected option and insert
    selected="selected" when rewriting the page.

    > The second problem is that I need a code for displaying the specific
    > table chosen by the user from the first combo.
    >
    > I’ve done it by an if statement but it didn’t work…
    > ...
    What did it do instead of what you wanted?
    Was there an error message?
    Is there a URL?


    --
    William Tasso - [url]http://WilliamTasso.com[/url]


    William Tasso Guest

  4. #3

    Default Re: search library system in asp



    hi

    william thanxx 4 replying..

    you told i have to capture the selected option.. how do i do that?? (ur
    talking to someone who knows nothing in asp)

    the second problem without the if statement it will always go to the
    book table.if i put the if statement it doen't go in it bcoz it always
    takes the value of y as 0.

    so its says that there is an error at this line:
    Set rstSearch = cnnSearch.Execute(strSQL)
    bcoz there is no object.

    hope u can help me in this


    thanxx alot



    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    amoona m 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