用ASP寫組件
更新時間:2006年08月25日 00:00:00 作者:
打開VB,新建AX DLL,工程名為Str,類名count,輸入如下代碼:
Public Function add(ByVal a As Double, ByVal b As Double, ByVal c As Integer, ByVal d As Integer) As Double
d = CInt(d)
If c = 1 Then '加
add = FormatNumber(a + b, d)
ElseIf c = 2 Then '減
add = FormatNumber(a - b, d)
ElseIf c = 3 Then '乘
add = FormatNumber(a * b, d)
ElseIf c = 4 Then '除
add = FormatNumber(a / b, d)
End If
End Function
參數(shù)說明:a,b 為需要計算的數(shù)值,c為計算類型,d為小數(shù)點保留多少位
客戶端ASP文件代碼:
set obj=server.CreateObject("str.count")
dim c
c=obj.Add(455,45,4,2)
Response.Write c
上面代碼執(zhí)行結果就是:455除以45,小數(shù)點精確到百分位
復制代碼 代碼如下:
Public Function add(ByVal a As Double, ByVal b As Double, ByVal c As Integer, ByVal d As Integer) As Double
d = CInt(d)
If c = 1 Then '加
add = FormatNumber(a + b, d)
ElseIf c = 2 Then '減
add = FormatNumber(a - b, d)
ElseIf c = 3 Then '乘
add = FormatNumber(a * b, d)
ElseIf c = 4 Then '除
add = FormatNumber(a / b, d)
End If
End Function
參數(shù)說明:a,b 為需要計算的數(shù)值,c為計算類型,d為小數(shù)點保留多少位
客戶端ASP文件代碼:
復制代碼 代碼如下:
set obj=server.CreateObject("str.count")
dim c
c=obj.Add(455,45,4,2)
Response.Write c
上面代碼執(zhí)行結果就是:455除以45,小數(shù)點精確到百分位
相關文章
用asp實現(xiàn)訪問遠程計算機上MDB access數(shù)據(jù)庫文件的方法
用asp實現(xiàn)訪問遠程計算機上MDB access數(shù)據(jù)庫文件的方法...2007-11-11
在Z-BLOG可用的新版ASP的GIF驗證碼[V70404]
在Z-BLOG可用的新版ASP的GIF驗證碼[V70404]...2007-04-04
Asp 使用 Microsoft.XMLHTTP 抓取網頁內容并過濾需要的
這篇文章主要介紹了Asp 使用 Microsoft.XMLHTTP 抓取網頁內容(沒用亂碼),并過濾需要的內容2014-05-05
實現(xiàn)純真IP txt轉mdb數(shù)據(jù)庫的方法
實現(xiàn)純真IP txt轉mdb數(shù)據(jù)庫的方法...2007-07-07

