473,573 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="#FFFFF F" text="#000000" >

<%

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

strURL = Request.ServerV ariables("URL")

strSearch = Request.QuerySt ring("search")
strSearch = Replace(strSear ch, "'", "''")
y=request("myme nu")

%>

<b>
<form name="form1" method="get" action="test.as p">
<font color="#32B0AF" size="2">
Search in:
</font>
<select name="mymenu" onchange="docum ent.form1.submi t()">
<option value="0" selected>---Select---</option>
<option value="1">Book</option>
<option value="2">Magaz ine</option>
<option value="3">Legal Gazzete</option>
<option value="4">Scien ce Paper</option>
<option value="5">Video </option>
<option value="6">Clipp ing</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">T itle</option>
<option value="author"> Author</option>
<option value="topic">T opic</option>
<option value="keyword" >Keyword</option>
</select>

<% Case "2"%>
<select name="sub">
<option value="0" selected>---Select---</option>
<option value="name">Na me</option>
<option value="title">T itle</option>
</select>

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

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

<% Case "5" %>
<select name="sub">
<option value="0" selected>---Select---</option>
<option value="title">T itle Keyword</option>
</select>
<% Case "6" %>
<select name="sub">
<option value="0" selected>---Select---</option>
<option value="title">T itle 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.CreateOb ject("ADODB.Con nection")

cnnSearch.Open "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
"Data Source=C:\Inetp ub\wwwroot\User Library
system.bak;" & _
"Jet OLEDB:System
Database=C:\Ine tpub\wwwroot\Se cured.mdw;", _
"staff", "envr"

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

Set rstSearch = cnnSearch.Execu te(strSQL)
%>

<table border="1">
<TR><TH>Book Id</th> <th>Title</th> <th>Topic</th></tr>
<%
Do While Not rstSearch.EOF
%>
<tr>
<td><%= rstSearch.Field s("bookid").Val ue %> </td>
<td><%= rstSearch.Field s("title").Valu e %> </td>
<td><%= rstSearch.Field s("topic").Valu e %> </td>
</tr>
<%
rstSearch.MoveN ext
Loop
%>
</table>
<%
rstSearch.Close
Set rstSearch = Nothing
cnnSearch.Close
Set cnnSearch = Nothing
End If
%>
</body>
</html>


Thanxxxxx for ur help
Jul 19 '05 #1
2 2066
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="selec ted" 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 - http://WilliamTasso.com
Jul 19 '05 #2


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.Execu te(strSQL)
bcoz there is no object.

hope u can help me in this
thanxx alot

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2041
by: AaronV | last post by:
Hello, I'm a webmaster for a college newspaper and I'm implementing an article search. I'm running PHP with a MySQL database to store the weekly stories. Does anyone know of an article that could offer good search theory. My top priority right now is multiple search terms and relevance sorting based on how many word hits are returned.
4
1594
by: middletree | last post by:
Intranet tech support system using ASP/VBScript running on W2000 Server, IIS, and using SQL Server 2000. I need to add a search engine. The problem with using a regular SQL query is that if you put a phrase, say "red car" in the text box, to hit submit, my SQL qurey would only look for that phrase, and would leave out other items where the...
83
5871
by: D. Dante Lorenso | last post by:
Trying to use the 'search' in the docs section of PostgreSQL.org is extremely SLOW. Considering this is a website for a database and databases are supposed to be good for indexing content, I'd expect a much faster performance. I submitted my search over two minutes ago. I just finished this email to the list. The results have still not...
3
654
by: RiceGuy | last post by:
Hi! I'm looking for ideas on what would the best approach to design a search system for a RSS feeds. I will have some 50 RSS feeds (all RSS 2.0 compliant) stored locally on the web server. Now I'm wondering what would the best method to allow searching of these RSS files. Since the search will cater to multiple users the search system has to...
12
6417
by: Vjay77 | last post by:
Hi, I haven't posted any problem in quite a while now, but I came to the point that I really need to ask for help. I need to create an application which will search through .txt log file and find all lines where email from hotmail occured. All these emails need to be printed to list box on the form. Problem with code you'll see below,...
3
1648
by: Pieter | last post by:
Hi, I need some search system, that will return me the records with in indicator of probability. This is for a VB.NET 2005 application with a SQL Server 2000 DataBase. I have a table with different columns in which the user needs to search. In case the search-routine finds the exact match (the same part of the sentence) it should return...
4
1363
by: Frank Potter | last post by:
I want to search something by a key word from inside my py script. The using google idea comes to my mind first because write a search programme from scratch is not so easy. I want to take advantage of goolge results, but I don't know how. To extract the result from html of google can get the result, but it's not reliable and stable because...
1
2077
by: gihope | last post by:
Hi, I wonder if someone could help me. I'm trying to develop a search algorithm as I need an engine that can determine the shortest route between two locations based on the number of stops. I have found an article called An Extensive Examination of Data Structures Using C# 2.0 (http://msdn2.microsoft.com/en-us/library/ms379574(VS.80).aspx)...
14
2960
by: S | last post by:
Any idea on how I would be able to do a search within C# that does ranges or words For example I want to search for Chicken in the string string s1 = "This is Great Chicken";
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8086
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2227
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1325
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1048
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.