Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > search library system in asp

Reply
Thread Tools

search library system in asp

 
 
amoona
Guest
Posts: n/a
 
      08-13-2003
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
| SEO , Search Engine Optimizer, SEARCH OPtiMIzAtIoN with SeaRch OPtiMizer optimizer.seo@gmail.com Digital Photography 0 04-22-2007 04:20 AM
System.Security.SecurityException: Error de solicitud de permiso de tipo System.Net.WebPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Luis Esteban Valencia ASP .Net 0 07-14-2005 01:43 PM
File System Search on an asp file yields not results Rafael Nenninger ASP General 2 11-01-2004 10:05 PM
search within a search within a search - looking for better way...my script times out Abby Lee ASP General 5 08-02-2004 04:01 PM
ASP.Net Code Library System arkam ASP .Net 0 04-28-2004 11:22 AM



Advertisments
 



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