Divided by Zero and Print Landscape
I use following coding to calculate the percentage.
IF NOT RS.EOF THEN
do while rs.eof=false
totalBH1 = (totalBH1 + cint(rs("BH")))
Response.Write("<td align=center>" & rs("BH") & "</td>")
total1 = (total1 + cint(rs("total")))
Response.Write("<td align=center>" & rs("total") & "</td>")
per = (total1/totalBH1)*100 // line 187
"<td align=center>" & per & "%" &"</td>" & _
some time values in totalBH1 is zero it give following error
Microsoft VBScript runtime (0x800A000B)
Division by zero
/tabulation/bmhours/FOWMHR2.asp, line 187
Zero can not be divided to any values. it is infinate value.
how can control this ?
if totalBH1 is ZERO it should display 0% how ?
in the PER field.
2. Secondly problem.
How can print the ASP page invoice in LANDSCAPE and
PORTRAIT ? and should be pring in center alignment.
3. how can set the printer setting in asp page ?