有一个Attendance表,四个字段(日期、工号、到岗时间、离岗时间)
到岗时间超过9点就是迟到,我想统计某一个工号的人本月迟到天数,并将结果显示在文本框中。
我用adodc连接数据库的,是不是应该使用count函数?怎么用,急求,谢谢了!

解决方案 »

  1.   

    sql=" select count(*) as i from Attendance where 工号='aa' and 到岗时间>9"
      

  2.   

    sql=" select 工号,count(*) as 迟到次数 from Attendance group by 工号 where  到岗时间>9"
      

  3.   


    看来我直接晕倒算了
    dim rs as adodb.recordsetsub form_load
    set rs=cnn.execute(sql)
    text1.datafield="迟到次数"
    set text1.datasource=rs
    end subsub command1_click
    rs.movenext
    if rs.eof then rs.movelast
    end ifsub command2_click
    rs.moveprevious
    if rs.bof then rs.movefirst
    end if