How big of a number will fit in this ASP code?
' Now get a Location_ID
'
Set RS = DB.Execute (AF.SQL("GenerateLocationID"))
开发者_运维技巧 Location_ID = CInt (RS(0).Value)
RS.Close
This is being written to an Oracle database defined with Number(10), but is returning the following error:
Microsoft VBScript runtime error '800a0006'
Overflow: 'CInt'
I'm suspicious, because the largest value in the Oracle table now is 32767. Is it a limit in the code that is creating the ID?
(The AF.SQL("GenerateLocationID") is 'Select Location_ID.NextVal from Dual', so it's just a standard Oracle select statement.
@thursdaysgeek: Quick fix might be --
Location_ID = CLng(RS(0).Value)
Or if you want to debug it
On Error Resume Next
Location_ID = CInt(RS(0).Value)
If Err.Number <> 0 Then
Response.Write RS(0).Value
End If
On Error GoTo 0
This should answer your question:
The CInt function converts an expression to type Integer. Note: The value must be a number between -32768 and 32767.
Based on the code it appears that Location_ID would have to be a short.
http://www.w3schools.com/VBScript/func_cint.asp
精彩评论