asp 获取最小值解决方案

asp 获取最小值
本帖最后由 szjxq1 于 2014-12-28 17:15:42 编辑
取这个(Et01tp001)取小的数字,大家帮忙看下怎么做,谢谢
<%
   SDPNR85 = Split(Et01c85,",")
   for i=0 to ubound(SDPNR85)

 If InStr(rocCont,""&Et01dm01&" "&SDPNR85(i)&" ") > 0 Then  
     Et01tc001 = Split(Split(rocCont,""&Et01dm01&" "&SDPNR85(i)&" ")(1)," ")(0)
 Else
     Et01tc001 = " "
 End If
   If isnumeric(Et01tc001) = True Then
 Et01tp001 = Round(Et01tc001*fare/100/10)*10
 Else
 Et01tp001 = "PAT"
 End If
 Response.write Et01tp001
   Next
%>
------解决思路----------------------
数组排序函数 
Function Sort(ary) 
KeepChecking = TRUE 
Do Until KeepChecking = FALSE 
KeepChecking = FALSE 
For I = 0 to UBound(ary) 
If I = UBound(ary) Then Exit For 
If ary(I) > ary(I+1) Then 
FirstValue = ary(I) 
SecondValue = ary(I+1) 
ary(I) = SecondValue 
ary(I+1) = FirstValue 
KeepChecking = TRUE 
End If 
Next 
Loop 
Sort = ary 
End Function 

数组排序函数应用例子 
Dim MyArray 
MyArray = Array(1,5,123,12,98) 
MyArray = Sort(MyArray) 
For I = Lbound(MyArray) to Ubound(MyArray) 
Response.Write MyArray(I) & "<br>" 
Next