CInt and clng meaning:
Can force an expression to be converted to a data type
CInt and clng The scope of processing data:
CInt integer-32,768 to 32,767, fractional part rounded.
CLng long-2,147,483,648 to 2,147,483,647, fractional part rounded.
The so-called overflow refers to the scope of processing data, the following code is to handle data to prevent overflow code, you can see for yourselves:
' Detect if it is a short integer
Copy Code code as follows:
Sub Is_int (String)
If Len (ABS (String)) >10 then Response.Write "Data Overflow": Response.End
If InStr (String, "-") <1 Then
If CInt (string,4) >3276 and CInt (right (string,1)) >7 then "Data Overflow": Response.Write
Else
If CInt (Left (ABS (String), 4)) >3276 and CInt (right (string,1) >8 then "Data Overflow": Response.Write
End If
End Sub
' Detect if it is a long integer
Copy Code code as follows:
Sub Is_lng (String)
If Len (ABS (String)) >10 then Response.Write "Data Overflow": Response.End
If InStr (String, "-") <1 Then
If CLng (string,9) >214748364 and CLng (right (string,1)) >7 then "Data Overflow": Response.Write
Else
If CLng (Left (ABS (String), 9)) >21478364 and CLng (right (string,1) >8 then "Data Overflow": Response.Write
End If
End Sub