Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2011, 02:41 AM
Registered User
 
Join Date: Mar 2011
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Default simple asp-ms access search turned nightmare :D

hi
i am trying to develop a simple job search page. for that i am trying to execute a simple form based search based on two drop downs 1) category 2) location with my ms access database. the db has just one table "jobs" and that has following fields

no (auto inc.), title (text), description (text), category (text), location (text)

here is my form code (listing.asp)

Quote:
<body>
<form id="form1" name="form1" method="post" action="search.asp">
<label>Select Category
<select name="cat" id="cat">
<option>Fund Management</option>
<option>Banking and Finance</option>
<option>Consulting</option>
<option>Commerce and Industry</option>
<option>Legal</option>
</select>
</label>
<label>Select Location
<select name="loc" id="cat">
<option>Africa</option>
<option>Hong Kong</option>
<option>Pakistan</option>
<option>Saudi Arabia</option>
<option>Singapore</option>
<option>United Kingdom</option>
<option>United States</option>
</select>
</label>

<input type="submit" name="submit" id="submit" value="Search" />

</form>
</body>
the search.asp has the following code

Quote:
<body>

<%
Dim conn
Dim rs
Dim strCat, strLoc

strCat = Request.Form("cat")
strLoc = Request.Form("loc")
'Response.Write strCat
'Response.Write strLoc

set conn=Server.CreateObject("ADODB.Connection")
conn.Open "job"
set rs=Server.CreateObject("ADODB.recordset")

sql="SELECT * FROM jobs " &_
"WHERE category = strCat " &_
"AND location = strLoc " &_
"ORDER BY category "
rs.Open sql, conn
'set rs = conn.execute(sql)
'if not rs.eof

conn.close
%>
</body>
and thats pretty much it...i do not know where to go from here :( please help.
 
Old March 21st, 2011, 01:01 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

After quering the database, you need to show the results. Example
http://www.w3schools.com/ado/showasp...e=demo_query_4
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
The Following User Says Thank You to om_prakash For This Useful Post:
alibilgrami (March 21st, 2011)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Product Search ASP.NET (C#) with MS Access ayazhoda ASP.NET 2.0 Basics 3 April 5th, 2007 10:15 AM
SQL ASP Nightmare... RichChick SQL Server ASP 1 October 5th, 2006 10:00 PM
Access issues with ASP and a MS Access Database rj_conceptsnrec.com Classic ASP Databases 2 May 19th, 2005 12:44 PM
ASP with MS ACCESS PHANI KISHOREKOTTAPALLI Classic ASP Components 6 May 10th, 2005 06:53 PM
ASP.NET using Crytsal Reports printing nightmare badgolfer ASP.NET 1.0 and 1.1 Basics 0 October 25th, 2004 07:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.