-- 作者:lisheng7177
-- 发布时间:2015/12/10 13:06:00
-- 查询按钮代码求助?
DataTables("鉴定上报表").DataRows.Clear For Each jdgz As String In dt.GetValues("鉴定工种") Dim dr As DataRow = DataTables("鉴定上报表").AddNew dr("鉴定工种") = jdgz dt = DataTables("报名登记表") dr("鉴定考核人数_初级工_2") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_中级工_3") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_高级工_4") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_技师_5") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_高级技师_6") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dt = DataTables("证书编号表") dr("取得证书人数_初级工_8") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_中级工_9") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_高级工_10") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_技师_11") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_高级技师_12") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) Next
DataTables("鉴定上报表").DataRows.Clear For Each dm As String In dt.GetValues("代码") Dim dr As DataRow = DataTables("鉴定上报表").AddNew dt = DataTables("报名登记表") dr("鉴定考核人数_初级工_2") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("鉴定考核人数_中级工_3") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("鉴定考核人数_高级工_4") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 代码 = \'" & dr("代码") & "\' and " & filter ) dr("鉴定考核人数_技师_5") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("鉴定考核人数_高级技师_6") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 代码 = \'" & dr("代码") & "\' and " & filter ) dr("代码") = dm dt = DataTables("证书编号表") dr("取得证书人数_初级工_8") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("取得证书人数_中级工_9") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("取得证书人数_高级工_10") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 代码 = \'" & dr("代码") & "\' and " & filter ) dr("取得证书人数_技师_11") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 代码 = \'" & dr("代码") & "\' and " & filter ) dr("取得证书人数_高级技师_12") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 代码 = \'" & dr("代码") & "\' and " & filter ) Next
上述代码的结果:“代码”列有数据,但“鉴定工种”列没有数据,为空,这是什么原因?
|
-- 作者:大红袍
-- 发布时间:2015/12/10 14:57:00
--
DataTables("鉴定上报表").DataRows.Clear For Each ary() As String In dt.GetValues("鉴定工种|代码") Dim dr As DataRow = DataTables("鉴定上报表").AddNew dr("鉴定工种") = ary(0) dr("代码") = ary(1) dt = DataTables("报名登记表") dr("鉴定考核人数_初级工_2") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_中级工_3") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_高级工_4") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_技师_5") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("鉴定考核人数_高级技师_6") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dt = DataTables("证书编号表") dr("取得证书人数_初级工_8") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'初级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_中级工_9") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'中级工\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_高级工_10") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级工\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_技师_11") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'技师\' and 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) dr("取得证书人数_高级技师_12") = dt.Compute("Count(身份证号码)", "鉴定等级 = \'高级技师\' And 鉴定工种 = \'" & dr("鉴定工种") & "\' and " & filter ) Next
|