Open VB and create an ax DLL. The project name is STR and the class name is count. Enter the following Code:
Copy codeThe Code is as follows: 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' plus
Add = formatnumber (a + B, d)
Elseif c = 2 then' minus
Add = formatnumber (a-B, d)
Elseif c = 3 then' Multiplication
Add = formatnumber (A * B, d)
Elseif c = 4 then' Division
Add = formatnumber (a/B, d)
End if
End Function
Parameter description: A and B are the values to be calculated, C is the calculation type, and D is the number of decimal places reserved.
Client ASP file code:
Copy codeThe Code is as follows: Set OBJ = server. Createobject ("str. Count ")
Dim C
C = obj. Add (455,45, 4,2)
Response. Write c
The execution result of the above Code is: 455 divided by 45, and the decimal point is accurate to the percentile.