|
Take a long hard look at this page at
learnasp.com, because it
is contains all the basics of DB access in ASP and all the documentation you'll need
to help understand it.
Here's the SQL modification for the page called by the search form:
searchstring = Request.Form("InputText")
myDSN="DSN=mp3zdat"
mySQL="select artist, title, location from mp3z where "
mySQL=MySQL & "artist like '%" & searchstring & "%'"
mySQL=MySQL & "or title like '%" & searchstring & "%'"
mySQL=MySQL & "or location like '%" & searchstring & "%'"
mySQL=MySQL & "order by location, artist"
Re-assembling the file and path strings from the retrieved data.
Add 'if-end ifs' for each column and store 'artistname' and 'songname' variables
from columns one and two.
if colcounter=0 then
'STORE artistname AND OUTPUT IT
artistname=thisfield
response.write "<td bgcolor='#ffffc0' valign=top>"
response.write thisfield
response.write "</td>" & vbcrlf
end if
if colcounter=1 then
'STORE songname AND OUTPUT IT
songname=thisfield
response.write "<td bgcolor='#ffffc0' valign=top>"
response.write thisfield
response.write "</td>" & vbcrlf
end if
In the last column they get stitched together around a 'Play' hyperlink paying
particular attention to how the quotes are used. All the HTML attributes are
single-quoted leaving double-quotes to wrap ASP strings.
if colcounter=numcols then
'BEGIN THE ANCHOR TAG WHICH COULD CONTAIN ANY PERMANENT PART OF THE PATH
response.write "<td bgcolor='#f0f0f0'><a href='\\mediabox\mp3_1"
'ADD THE PATH FROM THE DATABASE Location COLUMN
response.write thisfield & "\"
'ADD THE artistname, SEPERATOR (SPACE DASH SPACE), songname
'AND .mp3 EXTENSION, THEN CONTINUE CONSTRUCTING THE HYPERLINK
response.write artistname & " - " & songname & ".mp3" & "'>Play</a>"
response.write "</td>"
'I OUTPUT THE PATHNAME FOR TESTING PURPOSES
response.write "<td bgcolor='#ffffc0' valign=top>"
response.write thisfield & "</td>" & vbcrlf
end if
Needless to say things soon evolve. The Perl method outputs a file ready to be imported
into the database. The tab seperated list is imported into
MS Access with a single macro button, so the first useful functioning database looked like this:

...of course the temptation to expand the database and subsequent web interface using the vast amount of help
and tutorials available on the web, soon produces a database that seems to add up to more
than the sum of it's very simple parts...

...which I can never make up my mind how to display in the ASP pages.
An early version looked like this,
|
...which became the final HTML version...
|
...which provided a subject for a
Flash MX design
for the interface.
This latest version has viewable source code.
|
Previous
Back to chipwork.com.
|