Click to See Complete Forum and Search --> : Overflow: 'CInt' with a 20 digit number


Tahkas_ki
07-25-2003, 10:12 AM
I am trying to covert a 20 digit string, that is posted to the code below, to a number then I query a Sybase
database, based on the new 20 digit number. The datatype that I am trying to compare it to in sybase is numeric(20). I am new at ASP like 2 days so have pitty on ME!! I seem to remember that ASP - IIS 5.0 has
problems with large numbers.

Here is the code. You can see the error at the very bottom.

*******

<% @Language=VBScript %>
<% Option Explicit %>
<!--#include file="catuity.asp" -->

<%
Dim cardnumber, strCard, intCard, objConn, sQuery, objSet

strCard=trim(request.form("cardnumber"))


If strCard = "" then
response.redirect ("cardenter.asp?error=3")
End If

If IsNumeric(strCard) then
intCard = CInt(strCard)
Else
response.redirect ("cardenter.asp?error=2")
End If


Set objConn = Server.CreateObject("ADODB.Connection")
Set objSet = Server.CreateObject("ADODB.RecordSet")

objConn.ConnectionString = gConnectInfo
objConn.Open

sQuery = "select external_id, card_serial " _
& "from card " _
& "where external_id = " & intCard

objSet.Open sQuery, objConn, 0

IF objSet.EOF = True Then
response.redirect ("login.asp?error=1")
End If

Response.Write "<B>" & objSet.Fields("card_serial").Value & "</B>" &
gCRLF

objSet.Close
Set objSet = Nothing
objConn.Close
Set objConn = Nothing
%>

*******

Error Type:
Microsoft VBScript runtime (0x800A0006)
Overflow: 'CInt'
/new/just/verifycard.asp, line 16


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Page:
POST 45 bytes to /new/just/verifycard.asp

POST Data:
cardnumber=78935784216000000001&submit=submit

Tahkas_ki
07-25-2003, 01:20 PM
I have this number 78935784216000000019. That is passed as a string from one form, to a varify form. It needs to stay in this format and be coverted to numeric with no commas or no decimal places. So I can compaare it to a set of numbers that are in a database that are datatype numeric(20). using Cdbl gives me this 7.8935784216E+19.

Not good.

How do you take a 20 digit number and keep it the same 20 digit number but change its datatype to numeric?