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!

Pictures not displayed randomly

Status
Not open for further replies.

rkasnick

Programmer
Apr 28, 2003
66
US
I have a client application that uses an MSDE local database to build reports formatted as web pages including pictures. Pictures are stored in a virtual directory. Reports/web pages are built against a temp table in the MSDE with picture names in a field in the records. The problem is that not all of the pictures display, showing as broken links. This is apparently random, as rerunning the report results in different picture links being broken and those that showed broken previously now are automagically displayed. I believe it is only a matter of tweaking, but don't have a clue where to start. The page code is shown below:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Showroom Setup Report</title>
</head>
<body>
<style type="text/css">
<!--
td { font-family: sans-serif; font-size: 9pt; }
br.page { page-break-before: always; }
-->
</style>
<%
   dim conn, counter
   dim rs
    set conn = Server.CreateObject("ADODB.Connection")
    conn.Open "Provider=SQLOLEDB.1;SERVER=127.0.0.1;Database=Products;uid=sa;pwd=xxxxxx"
    set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open "SELECT preliminary_number, sb_number, item_picpath, series_vendor, series_description, item_description, factory_number, series_factory_assortment_comments, item_factory_component_comments, series_name from tblReports order by preliminary_number ASC", conn
   %>
<table border = "2" align="center" width="90%" cellspacing="0" cellpadding="4">
<tr>
<td align="center" colspan="3"><h1 style="font-family:verdana">Showroom Setup Report : <%=rs.fields(9) %></h1></td>
</tr>
<tr>
          <th align="left" valign="top" width="15%"> Item Picture </th>
          <th align="left" valign="top" width="12%"> Vendor<br/>Preliminary Number<br/>Factory Number<br/>SB Number</th>
          <th align="left" valign="top" width="50%"> Series Description<br/>Item Description<br/>Series Factory Assortment Comments<br/>Item Component Comments</th>
</tr>


<%
   While Not rs.EOF
   %>

<tr>
          <td align="left" valign="top" width="15%" rowspan = "6"> <IMG HEIGHT=150 Width=150 border=0 SRC="SBPictures/<%=RS.Fields(2)%>"></td>
          <td align="left" valign="top" width="12%" > <%= RS.Fields(3) %></td>
          <td align="left" valign="top" width="50%" colspan = "2" rowspan = "2"> <%= RS.Fields(4) %></td>
</tr>
<tr>
          <td align="left" valign="top" width="12%"> <%= RS.Fields(0) %></td>

</tr>
<tr>
          <td align="left" valign="top" width="12%"> <%= RS.Fields(6) %></td>
          <td align="left" valign="top" width="50%" colspan = "2" rowspan = "2"> <%= RS.Fields(5) %></td>
</tr>
<tr>
          <td align="left" valign="top" width="12%"> <%= RS.Fields(1) %></td>

</tr>
<tr>
          <td align="left" valign="top" width="15%"></td>
          <td align="left" valign="top" width="50%" colspan = "2"><%= RS.Fields(7) %></td>

</tr>
<tr>

          <td align="left" valign="top" width="15%"></td>
          <td align="left" valign="top" width="50%" colspan = "2"><%= RS.Fields(8) %></td>

</tr>
</tr>
<%
  Counter = Counter + 1
  if Counter = 5 then
     Response.Write "</table>"
     response.write "<br class=""page"" />"

 %>

     <table align="center" width="90%" border="2" cellspacing="0" cellpadding="4">
     <tr>
          <td align="center" colspan="3"><h1 style="font-family:verdana">Showroom Setup Report</h1></td>
     </tr>
     <tr>
          <th align="left" valign="top" width="15%"> Item Picture </th>
          <th align="left" valign="top" width="12%"> Vendor<br/>Preliminary Number<br/>Factory Number<br/>SB Number</th>
          <th align="left" valign="top" width="50%"> Series Description<br/>Item Description<br/>Series Factory Assortment Comments<br/>Item Component Comments</th>
          </tr>
 <%

     Counter = 0
  end if

 rs.MoveNext
 Wend

    rs.Close
    conn.Close
    set rs=nothing
    set conn=nothing
        
 %>



    
</table>
</body>
</html>
 
... don't have a clue where to start...

Do a "View Source" on a page where this happens to see the HTML output from your ASP page.

This will tell you HOW the HTML is getting hosed up and will help pinpoint the part of your ASP that needs to be tweaked.
 
what are trying to do with the counter...what to display 5 pics in a row or what??

-DNG
 
Thanks for the replies. I will check out the 'view source' as Sheco suggests.

DNG, the counter forces a page break after 5 records so the output fits nicely on 1 printed page without breaking a single records' details over 2 pages.
 
ok..i got that...the code looks fine to me...can you explain again the problem you are seeing...

-DNG
 
Ahhh, error resolved in part thanks to Sheco's tip. Viewing the source I noticed incorrect picture names, which led me to a logic problem in how the temp table was being built. Once the code was fixed the trouble went away and all is as it should be. Thanks for the answers guys.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top