以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  代码问题求教版主?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=72163)

--  作者:lisheng7177
--  发布时间:2015/7/24 15:53:00
--  代码问题求教版主?

Dim Result As DialogResult
Result = MessageBox.Show("确定导出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)
If result = DialogResult.Yes Then
    Dim Cols1() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
    Dim Cols2() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
    SystemReady = False
    For Each dr1 As DataRow In DataTables("报名登记表").Select("[资格审核] = True ")
        Dim dr2 As DataRow = DataTables("历史报名表").Find("身份证号码 = \'" & dr1("身份证号码") & "\' And 鉴定批次 = \'" & dr1("鉴定批次") & "\'")
        If dr2 Is Nothing Then
            dr2 = DataTables("历史报名表").AddNew
        End If
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
        Next
    Next
    SystemReady = True
End If

 

上述代码是“资格审核”全部为Ture的人员导出按钮代码,如果是Ture和False的全部导出,该怎么写?是不是可以不要这句?请版主指教?

 


--  作者:lisheng7177
--  发布时间:2015/7/24 15:58:00
--  
另外我发现随着批次的增多,哪怕我选定的是其中一个批次导过去,时间都很长,这是什么原因?
--  作者:大红袍
--  发布时间:2015/7/24 16:15:00
--  
以下是引用lisheng7177在2015/7/24 15:53:00的发言:

 

上述代码是“资格审核”全部为Ture的人员导出按钮代码,如果是Ture和False的全部导出,该怎么写?是不是可以不要这句?请版主指教?

 

 

For Each dr1 As DataRow In DataTables("报名登记表").Select("")


--  作者:大红袍
--  发布时间:2015/7/24 16:16:00
--  
以下是引用lisheng7177在2015/7/24 15:58:00的发言:
另外我发现随着批次的增多,哪怕我选定的是其中一个批次导过去,时间都很长,这是什么原因?

 

1、停止事件触发;

 

http://www.foxtable.com/help/topics/2218.htm

 

2、http://www.foxtable.com/help/topics/2225.htm

 


--  作者:lisheng7177
--  发布时间:2015/7/24 16:31:00
--  
图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看谢谢版主!!!!!!
--  作者:lisheng7177
--  发布时间:2015/7/28 9:51:00
--  

图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看

“资审通过导出”按钮代码:


Dim Result As DialogResult
Result = MessageBox.Show("确定导出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)
Dim Cols1() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
Dim Cols2() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
For Each dr1 As DataRow In DataTables("报名登记表").Select("[资格审核] = True ")
    Dim dr2 As DataRow = DataTables("审核合格表").Find("身份证号码 = \'" & dr1("身份证号码") & "\' And 鉴定批次 = \'" & dr1("鉴定批次") & "\'")
    If dr2 Is Nothing Then
        dr2 = DataTables("审核合格表").AddNew
    End If
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

以上是原来的代码,运行正常,就是速度很慢!!!!!!!!

 

Dim Result As DialogResult
Result = MessageBox.Show("确定导出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)
If result = DialogResult.Yes Then
    Dim Cols1() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
    Dim Cols2() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
    SystemReady = False
    Try
        Dim dr1 As New List(of DataRow)
        Dim dr2 As New List(of DataRow)
        For Each dr1 As DataRow In DataTables("报名登记表").Select("[资格审核] = True ")
            Dim dr2 As DataRow = DataTables("审核合格表").Find("身份证号码 = \'" & dr1("身份证号码") & "\' And 鉴定批次 = \'" & dr1("鉴定批次") & "\'")
            If dr2 Is Nothing Then
                dr1.Add(dr)
            Else
                dr2.Add(dr)
            End If
        Next
    Catch ex As Exception
        MessageBox.Show("资审通过导出失败")
    End Try
    SystemReady = True
    For Each dr As DataRow In dr1
        dr("资格审核") = True
    Next
    For Each dr As DataRow In dr2
        dr("资格审核") = False
    Next
    dr2 = DataTables("审核合格表").AddNew
End If
For i As Integer = 0 To Cols1.Length -1
    dr2(Cols2(i)) = dr1(Cols1(i))
Next
以上是我修改的代码,但总报错!我没学过编程,所以看了很久的“查询与赋值并存“”说明也没看得很明白,请版主指教!!!!!!谢谢先!!!!!!


--  作者:有点蓝
--  发布时间:2015/7/28 10:16:00
--  
Dim dr1 As New List(of DataRow)
Dim dr2 As New List(of DataRow)
放在Try End Try外面或者把 Try 去掉,这里似乎没必要用Try

--  作者:大红袍
--  发布时间:2015/7/28 10:21:00
--  

Dim Result As DialogResult
Result = MessageBox.Show("确定导出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)
If result = DialogResult.Yes Then
    Dim Cols1() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
    Dim Cols2() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","现岗位名称","参加工作时间","现工种工作时间","原技术资格等级","原等级取得时间","原资格证书工种","原资格证书编号","鉴定等级","申报鉴定工种","鉴定批次","申报性质","用工性质","原人才当量值","备注","照片","是否合格","资格审核","鉴定时间"}
   
    Dim dic As new Dictionary(Of DataRow, DataRow)
    For Each dr1 As DataRow In DataTables("报名登记表").Select("[资格审核] = True ")
        Dim dr As DataRow = DataTables("审核合格表").Find("身份证号码 = \'" & dr1("身份证号码") & "\' And 鉴定批次 = \'" & dr1("鉴定批次") & "\'")
        If dr Is Nothing Then
            dr = DataTables("审核合格表").AddNew
        End If
       
        dic.Add(dr, dr1)
    Next
    For Each key As DataRow In dic.Keys
        For i As Integer = 0 To Cols1.Length -1
            key(Cols2(i)) = dic(key)(Cols1(i))
        Next
    Next
End If

 


--  作者:lisheng7177
--  发布时间:2015/7/28 10:22:00
--  
图片点击可在新窗口打开查看谢谢!!!!!!我先改下试试!
--  作者:lisheng7177
--  发布时间:2015/7/28 10:27:00
--  
图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看还是不行!!!!!!