经典ASP App CINT失败-twitpocalypse v2 [英] Classic ASP App CINT failure - twitpocalypse v2

查看:69
本文介绍了经典ASP App CINT失败-twitpocalypse v2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于数量值超过了VBScript INT可以存储的数量,我收到了一个非常讨厌的错误消息(实际上是用户)...这完全是

Due to a qty value exceeding what a VBScript INT can store, I'm getting a pretty nasty error message (actually the users are)... This is totally a case of twitpocalypse.

由于CINT()在这种情况下不起作用,最佳的解决方法是什么?

Since CINT() will not work in this situation, what is the best workaround?

requestqty = 40200
CInt() max = 32767

CInt(requestqty) 

编辑
CLng()似乎可以解决问题,将所有CInt()更改为CLng()的代码可能会有任何风险.从我下面阅读的内容以及其他在网上看到的内容来看,似乎几乎没有理由使用CInt().我没有写这个特定的应用程序,也不知道为什么要在另一个应用程序上使用它,但是我宁愿不要band琐这个问题,而要在应用程序中完全解决这个问题,这样就不会再发生了……

EDIT
CLng() seems to do the trick, any risk to the code to change all CInt() to CLng(). From what I've read below and elsehwere on the web, it seems like there is really very little reason to even use CInt(). I didn't write this particular app and don't know why one was used over the other, but would prefer to not bandaid the issue and completely fix this issue in the app so it does not happen again...

推荐答案

在VBScript中始终使用long代替int(除非您特别希望将值限制为int范围).

Aways use long instead of int in VBScript (unless you specifically want to limit the value to the int range).

使用较小的类型对性能没有好处,并且由于所有变量都是变量,因此没有存储大小的好处,因此所有简单类型都使用相同的内存量.

There is no performance benefit for using the smaller type, and there is no storage size benefit because all variables are variants, so all simple types use the same amount of memory.

使用CLng函数而不是CInt函数.

这篇关于经典ASP App CINT失败-twitpocalypse v2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆