Ask a Question related to ASP Database, Design and Development.
-
gozilla #1
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
-
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... -
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... -
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.... -
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... -
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... -
Ray at #2
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...db> hi folks,
>
> I have found a script which enables me to search my mp3 db (soon my midi<TRIM>> which I will post on the web) but I
Ray at Guest
-
Aaron Bertrand - MVP #3
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
Well, I happen to agree with Ray on this one. If you'd rather we ignore> actually reading the post, <cough>Ray..
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
-
Jeff Cochran #4
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
Me Too! :)>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.)
Jeff
Jeff Cochran Guest
-
Ray at #5
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...you> >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>> >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
-
Daniel Whiting #6
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



Reply With Quote

