-- 作者: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/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: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
|