zuper89 Posted December 28, 2005 Share Posted December 28, 2005 How can i calculate information that is in a database with asp?example:I got 4 user in a databasehow can i get the avarage age og the members?example 2I 3 colons in a database table,wich is all number, how can i get the totalsum of the numbersSorry my english, Im Norwegian Link to comment Share on other sites More sharing options...
aspnetguy Posted December 29, 2005 Share Posted December 29, 2005 You could copy all information into arrays in ASP and then do your math calculations or you could do it all with a complex SQL query.What have you tried? Anything? Link to comment Share on other sites More sharing options...
zuper89 Posted December 29, 2005 Author Share Posted December 29, 2005 I did like this, and that worked nice ; <%DIM sumsum = (objPO("po_votes1") + objPO("po_votes2") + objPO("po_votes3") + objPO("po_votes4") + objPO("po_votes5") + objPO("po_votes6") + objPO("po_votes7") + objPO("po_votes8") )%> But i got another problem, if the answer is;51,6260162601626 how do i do to let it be 51,63 ?? Link to comment Share on other sites More sharing options...
aspnetguy Posted December 29, 2005 Share Posted December 29, 2005 DIM sumsum = (objPO("po_votes1") + objPO("po_votes2") + objPO("po_votes3") + objPO("po_votes4") + objPO("po_votes5") + objPO("po_votes6") + objPO("po_votes7") + objPO("po_votes8"))sum = Round(sum, 2) or Dim sumsum = Round(objPO("po_votes1") + objPO("po_votes2") + objPO("po_votes3") + objPO("po_votes4") + objPO("po_votes5") + objPO("po_votes6") + objPO("po_votes7") + objPO("po_votes8"), 2) Link to comment Share on other sites More sharing options...
pulpfiction Posted December 29, 2005 Share Posted December 29, 2005 VBScript function, round()check out this sitehttp://www.w3schools.com/vbscript/func_round.asp Link to comment Share on other sites More sharing options...
zuper89 Posted December 29, 2005 Author Share Posted December 29, 2005 Thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted December 29, 2005 Share Posted December 29, 2005 No problem VBScript function, round()<{POST_SNAPBACK}> Thats what I said. Link to comment Share on other sites More sharing options...
pulpfiction Posted December 29, 2005 Share Posted December 29, 2005 HI aspnetguy, I didnt see ur reply when i replied, probably we replied in the same time. Link to comment Share on other sites More sharing options...
aspnetguy Posted December 29, 2005 Share Posted December 29, 2005 Figured that is what it was. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now