以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  查询按钮代码求助?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=78502)

--  作者: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:32:00
--  

去掉这句代码

 

DataTables("鉴定上报表").DataRows.Clear

 

这句代码的意思是删除所有的行数据啊


--  作者:lisheng7177
--  发布时间:2015/12/10 14:50:00
--  

去掉后出新问题:比如有100个工种,前100行“鉴定工种”列有内容,“代码”列为空;后100行“鉴定工种”列为空,“代码”列有内容;

我想要的结果是:这100行“鉴定工种”列和“代码”列同时有内容,且和“工种目录表”中的“鉴定工种表”列和“代码”对应


--  作者:lisheng7177
--  发布时间:2015/12/10 14:56:00
--  
这个“鉴定上报表”的作用是:查询某个时间段内的各鉴定工种的各等级的报考人数和取证人数,同时对应的代码也相应查出
--  作者:大红袍
--  发布时间: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

 


--  作者:lisheng7177
--  发布时间:2015/12/10 15:01:00
--  
图片点击可在新窗口打开查看多谢版主!现在搞定了!