Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

ASP Multiplication

Options
  • 23-03-2006 12:48pm
    #1
    Registered Users Posts: 224 ✭✭


    Hi,

    Im looking to divide one field by another and display the answer on the same page...anybody know the coding behind that.

    Cheers


Comments

  • Registered Users Posts: 2,647 ✭✭✭impr0v


    <%
    Dim result
    result = ((my_recordset.Fields.Item("field1").Value)/(my_recordset.Fields.Item("field2").Value))
    response.write(result)
    %>
    

    Edit: initially read multiply instead of divide!


  • Registered Users Posts: 224 ✭✭The Mighty Dubs


    legendary. That works brilliantly but Sorry to be a pain but my results are coming up like this 1.35833333333333. Is it possible to return an answer like this 1.35???


  • Moderators, Politics Moderators Posts: 39,800 Mod ✭✭✭✭Seth Brundle


    http://www.w3schools.com/vbscript/func_round.asp will round off numbers - however reducing 1.358... to 1.35 is more like just taking the leftmost 4 characters - use the left function


Advertisement