日期:2014-05-17  浏览次数:20965 次

求高人指点!在线等!!asp中如何不以科学计数法显示
asp中如何不以科学计数法显示数值

------解决方案--------------------
VBS的话用FormatNumber()
FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])
Arguments
Expression
Required. Expression to be formatted.
NumDigitsAfterDecimal
Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer 's regional settings are used.
IncludeLeadingDigit
Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
UseParensForNegativeNumbers
Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits
Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. See Settings section for values.
Settings
The IncludeLeadingDigit, UseParensForNegativeNumbers, and GroupDigits arguments have the following settings:

Constant Value Description
TristateTrue -1 True
TristateFalse 0 False
TristateUseDefault -2 Use the setting from the computer 's regional settings.

Remarks
When one or more of the optional arguments are omitted, the values for omitted arguments are provided by the computer 's regional settings.

Note All settings information comes from the Regional Settings Number tab.
The following example uses the FormatNumber function to format a number to have four decimal places:

Function FormatNumberDemo
Dim MyAngle, MySecant, MyNumber
MyAngle = 1.3 ' Define angle in radians.
MySecant = 1 / Cos(MyAngle) ' Calculate secant.
FormatNumberDemo = FormatNumber(MySecant,4) ' Format MySecant to four decimal places.
End Function

------解决方案--------------------
vbs不像c#那么严谨,所以处理的时候要转换

FormatNumber 函数 语言参考
版本 2


请参阅


--------------------------------------------

描述
返回表达式,此表达式已被格式化为数值。
语法
FormatNumber(expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])
FormatNumber 函数的语法有以下参数:

参数 描述
expression 必选。要被格式化的表达式。
NumDigitsAfterDecimal 可选。指示小数点右侧显示位数的数值。默认值为 -1,指示使用的是计算机的区域设置。
IncludeLeadingDigit 可选。三态常数,指示是否显示小数值小数点前面的零。有关数值,请参阅“设置”部分。
UseParensForNegativeNumbers 可选。三态常数,指示是否将负值置于括号中。有关数值,请参阅“设置”部分。
GroupDigits 可选。三态常数,指示是否使用计算机区域设置中指定的数字分组符号将数字分组。有关数值,请参阅“设置”部分。


设置
IncludeLeadingDigit、UseParensForNegativeNumbers 和 GroupDigits 参数可以有以下值:
常数 值 描述
TristateTrue -1 True
TristateFalse 0 False
TristateUseDefault -2 使用计算机区域设置中的设置。


说明
当省略一个或多个可选参数时,由计算机区域设置提供被省略参数的值。
--------------------------------------------

注意 所有设置信息均取自区域设置的“数字”附签。

--------------------------------------------


下面例子利用 FormatNumber 函数把数值格式化为带四位小数点的数:

Function FormatNumberDemo
Dim MyAngle, MySecant, MyNumber
MyAngle = 1.3 ' 用弧度定义角。
MySecant = 1 / Cos(MyAngle) ' 计算正割值。
FormatNumberDemo = FormatNumber(MySecant,4) ' 把 MySecant 格式化为带四位小数点的数。
End Function


------解决方案--------------------
FormatNumber 函数
返回表达式,此表达式已被格式化为数值。