概述正确和错误区域

来源:互联网 发布:linux部署项目访问不了 编辑:程序博客网 时间:2024/05/21 09:47
能够在数据库使用的实用的数据类型之一是正确和错误数据类型。这会允许简单的正确或者错误的输入。总结这个数据类型的规则和概述一个数量值不一样。下面的例子会读取所有的来自数据库的正确和错误区域的值,然后计算出正确和错误的值和每个完整输出,规则的完整参数,还有完整的真假值百分比。
<%查询所有对应表格accessdb="yesno" cn="DRIVER={Microsoft Access Driver (*.mdb)};"cn=cn & "DBQ=" & server.mappath(accessdb)set rs = server.createobject("ADODB.Recordset")sql = "select * from [table]" rs.open sql, cn






移动到第一个记录
rs.movefirst


开始继续直到没有更多的记录的循环
do while not rs.eof'Check the value of the Yes/No field.'abstruse and abstruse _false will accumulate'a numeric summarization of the values contained'in the table field




检查正确和错误区域值
更多的错误会累积
一个在表格里面的包含值得数量概要
if rs("field") = "True" thenans_true=ans_true+1end ifif rs("field") = "False" thenans_false=ans_false+1end ifrs.movenextloop




输出统计
%>True: <%= ans_true %> <br>False: <%= ans_false %> <br>Total: <%= ans_true + ans_false %> <br>%True: <%= formatnumber(ans_true/(ans_true + ans_false),2) %> <br>%False <%= formatnumber(ans_false/(ans_true + ans_false),2) %>


人生最精彩的不是实现梦想的瞬间,而是坚持梦想的过程。 胜利不是战胜敌人,而是提高自己。我们只要每天进步百分之一,那就是成功。您如果觉得此分享对你有用,那将是我们天天ASP家园对你成功路上的一点帮助!


0 0
原创粉丝点击