VB Runtime Error - Overflow - Divisable by zero

Hi i have this code that fails at line Response.Write intWins/intGames as soon as i have a zero a value (divisable by 0)




                  <%
                  Set RS_Entrant = Server.CreateObject("ADODB.Recordset")
                  SQL_Entrant = "SELECT * FROM tblEntrants"
                  RS_Entrant.Open SQL_Entrant,Connection,3,3
                  Do While Not RS_Entrant.EOF
                  intName = RS_Entrant("txtName")
                  intGames = RS_Entrant("intGames")
                  intWins = RS_Entrant("intWins")
                  %>
                        <tr>
                              <td><% Response.Write intName %></td>
                              <td><% Response.Write intGames %></td>
                              <td><% Response.Write intWins %></td>
                              <td>
                              <%
                              IF isNull(intWins) OR isNull(intGames) THEN
                                    Response.Write "No Data"
                              ELSE
                                    Response.Write intWins/intGames
                              END IF
                              %>
                              </td>
                              <td>&nbsp;</td>
                              <td>&nbsp;</td>
                        </tr>
                  <%
                  RS_Entrant.MoveNext
                  Loop
                  RS_Entrant.Close
                  Set RS_Entrant = Nothing
                  %>

Can any one help?
net-workxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nschaferCommented:
You should probably look at your logic to find out why you would be dividing by a value that might be zero, but the following should eliminate the error.

  IF isNull(intWins) OR isNull(intGames) THEN
     Response.Write "No Data"
  ELSE
    if intGames <> 0 then
      Response.Write intWins/intGames
    else
      Response.write 0
    end if
  END IF
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
net-workxAuthor Commented:
Its for a little tournament thing so logic is ok, just that if someone hasnt won anything then it cant divide!

Anyway, you got the points!

Thanks for help!

Carl
0
nschaferCommented:
Glad I could help,

Neal.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.