Foxtable(狐表)用户栏目专家坐堂 → 代码问题求教版主?


  共有3464人关注过本帖树形打印复制链接

主题:代码问题求教版主?

帅哥哟,离线,有人找我吗?
lisheng7177
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
代码问题求教版主?  发帖心情 Post By: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
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/24 15:58:00 [只看该作者]

另外我发现随着批次的增多,哪怕我选定的是其中一个批次导过去,时间都很长,这是什么原因?

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/7/24 16:15:00 [只看该作者]

以下是引用lisheng7177在2015/7/24 15:53:00的发言:

 

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

 

 

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


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By: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
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/24 16:31:00 [只看该作者]

图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看谢谢版主!!!!!!

 回到顶部
帅哥哟,离线,有人找我吗?
lisheng7177
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By: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
以上是我修改的代码,但总报错!我没学过编程,所以看了很久的“查询与赋值并存“”说明也没看得很明白,请版主指教!!!!!!谢谢先!!!!!!


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110592 积分:562856 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By: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

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By: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
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:22:00 [只看该作者]

图片点击可在新窗口打开查看谢谢!!!!!!我先改下试试!

 回到顶部
帅哥哟,离线,有人找我吗?
lisheng7177
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:27:00 [只看该作者]

图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看还是不行!!!!!!

 回到顶部
总数 26 1 2 3 下一页