I have the followin Script:
--------------------------
----------
----------
----------
----------
-----Probl
em--------
----------
----------
----------
----------
----------
----------
----------
---
<%
set objConnection=Server.Creat
eObject("A
DODB.Conne
ction")
objConnection.ConnectionTi
meout = 15
objConnection.CommandTimeo
ut = 10
objConnection.Mode = 3 'adModeReadWrite
if objConnection.state = 0 then
objConnection.Open "Site0001"
end if
strSQL = "SELECT Count(*) AS tCar, Count(T_AMT_TAX) AS billedTrans, Count(T_VOIDCODE) AS totalVoid, Count(T_FLEET) AS totalFleet, AVG(T_AMT_TAX) AS numT_AMT_TAX, SUM(T_AMT_TAX) AS numsT_AMT_TAX, SUM(T_DISCOUNT) AS numT_DISCOUNT, SUM(T_TAX) AS numT_TAX, AVG(T_DISCOUNT) AS numsT_DISCOUNT FROM Tranhead"
set objRS=Server.CreateObject(
"ADODB.Rec
ordSet")
objRS.Open strSQL,objConnection,3,3
tCars=objRS("tCar")
bCars=objRS("billedTrans")
tFleet=objRS("totalFleet")
tVoid=objRs("totalVoid")
tCSI=FormatCurrency(objRS(
"numT_AMT_
TAX"))
tDisc=FormatCurrency(objRS
("numT_DIS
COUNT"))
tTax=FormatCurrency(objRS(
"numT_TAX"
))
gTotal=FormatCurrency(objR
S("numsT_A
MT_TAX"))
avgDisc=FormatCurrency(obj
Rs("numsT_
DISCOUNT")
)
objRS.Close
Set objRS = Nothing
objConnection.close
set objConnection = Nothing
%>
The variables are displayed in a prebuild table like follow:
<table border="1" width="100%" cellspacing="0" cellpadding="0" id="table1" style="text-indent: 0; line-height: 100%; word-spacing: 0; margin: 0">
<tr>
<td width="38" align="center" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Logged</fo
nt></b></p
>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Veh</font>
</b></td>
<td align="center" width="48" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Billed&nbs
p; </font></b>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Veh</font>
</b></td>
<td align="center" width="38" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Total </font></b></p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Fleets</fo
nt></b></t
d>
<td align="center" width="64" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Average</f
ont></b></
p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Ticket</fo
nt></b></t
d>
<td align="center" width="76" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Total</fon
t></b></p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Discount</
font></b><
/td>
<td align="center" width="70" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Total Tax</font></b></td>
<td align="center" width="61" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Average</f
ont></b></
p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Discount</
font></b><
/td>
<td align="center" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Grand</fon
t></b></p>
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Total</fon
t></b></td
>
<td align="center" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font color="#FFFF00" face="Verdana" size="1">Voided</font></b>
</td>
<td align="center" bgcolor="#000000">
<p style="margin-top: 0; margin-bottom: 0"><b>
<font face="Verdana" size="1" color="#FFFF00">Removed</f
ont></b></
td>
</tr>
<tr>
<td width="47" align="center" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700"> <%=tCars%></fon
t></td>
<td align="center" width="48" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700" color="#800080"> <%=b
Cars%></fo
nt></td>
<td align="center" width="38" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700"> <font color="#FF00FF"><%=tFleet%
></font></
font></td>
<td align="center" width="64" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700"> <%=tCSI%></font
></td>
<td align="center" width="76" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700" color="#FF0000"> <%=t
Disc%></fo
nt></td>
<td align="center" width="70" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700"> <%=tTax%></font
></td>
<td align="center" width="61" bgcolor="#FFFFFF">
<font face="Verdana" style="font-size: 70%; font-weight: 700" color="#FF0000"> <%=a
vgDisc%></
font></td>
<td align="center" bgcolor="#FFFFFF" width="58">
<font face="Verdana" style="font-size: 70%; font-weight: 700" color="#008000"> <%=g
Total%></f
ont></td>
<td align="center" bgcolor="#FFFFFF" width="40">
<font face="Verdana" style="font-size: 70%; font-weight: 700"> <%=tVoid%></fon
t></td>
<td align="center" bgcolor="#FFFFFF" width="49">
</td>
</tr>
</table>
--------------------------
----------
----------
----------
----------
-Question-
----------
----------
----------
----------
----------
----------
----------
------
I need to display Value 0 or N/A if
1.-the connection to the table is not available
2.-or if the table is empty.
in a way I need to get red of the "page cannot be displayed" message when Data is not available
Thanks in advance
Start Free Trial