ASP page not showing without records

G

Guest

Dear Sirs
I have an ASP page in a table style (heading and data).
At the beginn of each month (actually only the first day) there is no data
in my database and so-with nothing to show up on the ASP page.
If I would like to open the ASP page over the net IE is telling me that it
cannot find my page. I believe it has something to do with EOF - but I have
no idea how to make it work.
Can someone tell me how, even if there are no records to show, at least the
heading is shown on the Internet?

Here is the code:

<body class="formpage" style="background-color: #DFDFDF" topmargin="6"
leftmargin="0" rightmargin="0" bottommargin="0">

<table width="561" border="0" height="100">

<tr>
<td align="Left" valign="Middle" height="96" width="555" >
<form method="GET" action="offsetordersbie30p.asp"
name="weboffsetordersbie30p" onSubmit="return Checkform(this);">
<table border="0" cellpadding="0" cellspacing="0" class="formpagetable"
width="303" style="border-width: 0">
<tr>
<td colspan="2">
<table width="552" border="0">
<tr>

<td align="left" valign="top" height="14" width="548"><img border="0"
src="../BIE/images/c1_top.GIF" width="547" height="14"></td>
</tr>

</tr>
</table>
</td>
<table border="0" width="490" height="40">

<tr>
<td align="center" valign="top" class="formpagetablelabel"
width="54"><b>Fecha</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="15"><b>C</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="15"><b>V</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="143"><b>Mercancía</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="48"><b>Mes</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="25"><b>Año</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="64"><b>Precio</b></td>
<td align="center" valign="top" class="formpagetablelabel"
width="92"><b>Valor</b></td>
</tr>
<%
Set conntemp = server.CreateObject("adodb.Connection")
conntemp.open
"DSN=access;Database=f:\www.???????????.com\????\????????????.mdb"

SqlStr ="SELECT * FROM weboffsetordersbie30p ORDER BY commodity"

Set rsTable = conntemp.Execute(SqlStr)

' Cycle through the recordset, building a table row from each record.
While not rsTable.EOF
%>
<tr>
<td width="54"><input class="formpagetablefield" type="text"
style="text-align: center;" name="fecha" size="9"
Value="<%=trim(rsTable("fecha"))%>"></td>
<td width="15"><input class="formpagetablefield" type="text"
style="text-align: center;" name="bought" size="1"
Value="<%=trim(rsTable("bought"))%>"></td>
<td width="15"><input class="formpagetablefield" type="text"
style="text-align: center;" name="sold" size="1"
Value="<%=trim(rsTable("sold"))%>"></td>
<td width="143"><input class="formpagetablefield" type="text"
style="text-align: center;" name="commodity" size="27"
Value="<%=trim(rsTable("commodity"))%>"></td>
<td width="48"><input class="formpagetablefield" type="text"
style="text-align: center;" name="month" size="8"
Value="<%=trim(rsTable("month"))%>"></td>
<td width="25"><input class="formpagetablefield" type="text"
style="text-align: center;" name="year" size="3"
Value="<%=trim(rsTable("year"))%>"></td>
<style type="text/css">
<!--
..pos {
font-family: Tahoma; font-size: 8pt;
color: #000000;
text-align:right;
}
..neg {
font-family: Tahoma; font-size: 8pt;
color: #FF0000;
text-align:right;
}
-->
</style>
<%
If CSng(rsTable("price")) < 0 Then
textboxclass = "neg"
Else
textboxclass = "pos"
End If
%>

<td width="64"><input class="<%=textboxclass%>" type="number" name="price"
size="8" Value="<%=formatnumber(rsTable("price"),4,-1,-1,-1)%>"></td>
<style type="text/css">
<!--
..pos {
font-family: Tahoma; font-size: 8pt;
text-align:right;
color: #0000FF;
}
..neg {
font-family: Tahoma; font-size: 8pt;
text-align:right;
color: #FF0000;
}
-->
</style>
<%
If CSng(rsTable("contractvalue")) < 0 Then
textboxclass = "neg"
Else
textboxclass = "pos"
End If
%>

<td width="92"><input class="<%=textboxclass%>" type="number"
name="contractvalue" size="12"
Value="<%=formatNumber(rsTable("contractvalue"),2,-1,-1,-1)%>"></div></td>
</tr>

<%
rsTable.movenext
Wend
' Close recordset
rsTable.Close
Set rsTable = Nothing

' Close connection
conntemp.Close
Set conntemp = Nothing
%>

</table>
</form>


</tr>


</table>
 
R

Ronx

Change:

' Cycle through the recordset, building a table row from each record.
While not rsTable.EOF
%>

To:

If rsTable:EOF then
'no records found
%>
<tr><td colspan="8">No records found</td></tr>
<% else
' Cycle through the recordset, building a table row from each record.
While not rsTable.EOF
%>


Then change:

<%
rsTable.movenext
Wend
rsTable.Close
Set rsTable = Nothing

To

<%
rsTable.movenext
Wend
End If
rsTable.Close
Set rsTable = Nothing


But you should not be getting a Page not found error - the error, if
any, should be something else.

Your style definitions should also be in the <head> section of the page
(once only), not interspersed between table rows and cells a multitude
of times.
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.
FrontPage Support: http://www.frontpagemvps.com/
http://www.rxs-enterprises.org/fp
 
D

David Berry

If you're getting a Page Not Found error make sure that you've published the
page. If you have you may want to check with your ISP to see if there are
any issues on the server, such as ASP not being allowed.

If it's another error then go to the setting in Internet Explorer and under
Advanced Settings un-check the box to show friendly error messages so you
cans see what the real error is
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top