asp 循环语句 如何写?

2025-05-18 06:02:52
推荐回答(1个)
回答1:

你可以写一个函数来实现,这样哪里用就在哪里调用函数就可以了,方便点。
比如:

function countsql(typ,wtime,wcond)
dim f_rs
f_rs=conn.execute("select count(*) from [workcondition_table] where [worker_dp]='" & typ & "' and [work_time]=#" & wtime & "# and [work_condition]='" & wcond & "'")
countsql=f_rs(0)
end function
调用时就用(例):
<%=countsql("it","2015-11-12","正常")%>
<%=countsql("it","2015-11-12","休息")%>
<%=countsql("it","2015-11-12","请假")%>
望采纳,谢谢!