当前位置: 移动技术网 > IT编程>开发语言>Asp > asp 自定义分段函数/求第N名成绩

asp 自定义分段函数/求第N名成绩

2017年12月12日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:function splitx(strs1 as string, strs2 as string, n as integer) '自定义分段函数 spl
复制代码 代码如下:

function splitx(strs1 as string, strs2 as string, n as integer)

'自定义分段函数 splitx([字符串],"分隔符",第n段)
dim groupst() as string
groupst = split(strs1, strs2)
if ubound(groupst) < n - 1 then
splitx = 0
else
splitx = groupst(n - 1)
end if
end function

'/-------------------------------------
function minx(ksmc as string, lb as string, kmi as string, n as string)

'第n名的成绩 minx([考试名称],[类别],[科目],n)
dim con as object
dim rs as object
dim stsql as string
dim kmf as string
kmf = mid(kmi, 1, 1) & "组"

set con = application.currentproject.connection
set rs = createobject("adodb.recordset")
strsql = "select top 1 " & kmi & " as 达标分 from 成绩总表 "
strsql = strsql + " where ((( " & kmf & " ) <= " & n & ") and ((类别) = '" & lb & "' and 考试名称='" & ksmc & "'))"
strsql = strsql + " order by " & kmi
rs.open strsql, con, 3, 3
if rs.eof then
minx = 0
else
minx = rs("达标分")
end if
rs.close
set rs = nothing
set con = nothing
end function

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网