Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying links of filenames from a database

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
Please impart wisdom starting now,

I have a list of .mp3 file names in my database base. I intend to have links to files which are stored on the server. I can successfully create one link to the file, but looping provides a problem, I need advice/ideas on syntax to be included in my sql queries.

here's the code, any ideas appretiated

Gav

<%
Dim oRS3
Set oRS3=Server.CreateObject(&quot;adodb.Recordset&quot;)
sqlText = &quot;SELECT ArtistNameTable.ArtistName, ArtistNameTable.Style, ArtistNameTable.SongName, ArtistNameTable.Price, ArtistNameTable.MP3Name &quot;
sqlText = sqlText & &quot; FROM ArtistNameTable &quot;
sqlText = sqlText & &quot; WHERE Style='rock' &quot;
sqlText = sqlText & &quot; ORDER by ArtistNameTable.Style;&quot;

oRS3.Open sqlText, &quot;DSN=music&quot;
oRS3.MoveFirst
MP3Name = oRS3(&quot;MP3Name&quot;).value

Response.Write &quot;<table border=1>&quot;
Do while NOT oRS3.EOF
Response.Write &quot;<tr><td>&quot; & oRS3(&quot;Style&quot;) & &quot;</td>&quot;
Response.Write &quot;<td>&quot; & oRS3(&quot;ArtistName&quot;) & &quot;</td>&quot;
Response.Write &quot;<td>&quot; & oRS3(&quot;SongName&quot;) & &quot;</td>&quot;
Response.Write &quot;<td>&quot; & oRS3(&quot;Price&quot;) & &quot;</td>&quot;

oRS3.MoveNext
loop
oRS3.Close
Set oRS3=Nothing
%>
''this is the present effort, need to place in reponse write but ASP 'is having none of it'
<td><a href=&quot;/_private/images/<%=MP3Name%>&quot;>link is hear</a></td></tr>




</table>

</body>
</html>
 
To create the link, use code like this:

[tt]
Do while NOT oRS3.EOF
[tab]Response.Write &quot;<tr>&quot;
[tab]Response.Write &quot;<td>&quot; & oRS3(&quot;Style&quot;) & &quot;</td>&quot;
[tab]Response.Write &quot;<td>&quot; & oRS3(&quot;ArtistName&quot;) & &quot;</td>&quot;
[tab]Response.Write &quot;<td>&quot;
[tab]Response.Write &quot;<A HREF='/_private/images/&quot; & MP3Name & &quot;'>&quot;
[tab]Response.Write oRS3(&quot;SongName&quot;)
[tab]Response.Write &quot;</A>&quot;
[tab]Response.Write &quot;</td>&quot;
[tab]Response.Write &quot;<td>&quot; & oRS3(&quot;Price&quot;) & &quot;</td>&quot;
[tab]Response.Write &quot;</tr>&quot;
[tab]oRS3.MoveNext
Loop
[/tt]

BTW: you're not closing your table rows either. Netscape will choke on that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top