View Single Post
  #1 (permalink)  
Old May 13th, 2005, 08:25 AM
mateenmohd mateenmohd is offline
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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>")

rs.movenext
loop

per = (total1/totalBH1)*100 // line 187

end if

"<td align=center>" & per & "%" &"</td>" & _


some time values in totalBH1 is zero it give following error

Error Type:
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 ?

regards.

Mateen







Reply With Quote