Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 image paths query for multiple image paths

Author  Topic 

Anessa
Starting Member

4 Posts

Posted - 2005-09-08 : 12:14:51
Hello,

I need to build a sql query to a db table that has multiple columns for 6 different image paths that would check for the existence of a path in each column, then call the image paths for display of each existing image in a table cell.

What I currently have can only display one existing image or displays a broken image icon when more than one image exists. I'm just stumped on how to get it to display all existing images. Here's the code...

<td>
<img src="<%= rs("image_path")%><%= rs("image_path2")%>
<%= rs("image_path3")%><%= rs("image_path4")%>
<%= rs("image_path5")%><%= rs("image_path6")%>">
</td>

Any assistance would be greatly appreciated.

Anessa

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-09-08 : 12:31:34
Sounds like a denormalized table structure that needs fixing... but if you must..

<td>
<%IF IsNull(rs("image_path")) = FALSE THEN %>
<img src="<%= rs("image_path")%>">
<%END IF
IF IsNull(rs("image_pat2")) = FALSE THEN %>
<img src="<%= rs("image_path2")%>">
<%END IF
IF IsNull(rs("image_pat3")) = FALSE THEN %>
<img src="<%= rs("image_path3")%>">
<%END IF
IF IsNull(rs("image_pat4")) = FALSE THEN %>
<img src="<%= rs("image_path4")%>">
<%END IF
IF IsNull(rs("image_pat5")) = FALSE THEN %>
<img src="<%= rs("image_path5")%>">
<%END IF
IF IsNull(rs("image_pat5")) = FALSE THEN %>
<img src="<%= rs("image_path6")%>">
<%END IF%>
</td>

This should work. My ASP classic has gotten a little rusty lately.

====================================================
Regards,
Sean Roussy

"pimpin ain't easy, but someone has to do it" -- Pimpin Whitefolks(?)
Go to Top of Page
   

- Advertisement -