Jump to content

Convert database value to integer ?


Yammaski
 Share

Recommended Posts

This works when the varPostcode is even or odd, but when I change (1235) to a value from my database (rsTest.Fields.Item("Postcode").Value), it doesn't work anymore. I tried it with CInt, but also no result. Postcode is as "text" in the db.

<%varPostcode=(1235)Call OddEvenNumber(varPostcode)Sub OddEvenNumber(iNumber)If iNumber MOD 2 = 0 ThenResponse.write ("EVEN")ElseResponse.write ("ODD")End IfEnd Sub%>

Link to comment
Share on other sites

  • 3 weeks later...

I'd try it. It works fine.

Dim NumValNumVal = Int([i]from database[/i])If Not isNumeric(NumVal) ThenResponse.Write "Not a set of number."ElseResponse.Write "A set of number is processed." ' This line is returned in my browser. Please check your script and database once again.End If

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...