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


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

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

帅哥哟,离线,有人找我吗?
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 [显示全部帖子]

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

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


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

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

 回到顶部
帅哥哟,离线,有人找我吗?
lisheng7177
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | 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
以上是我修改的代码,但总报错!我没学过编程,所以看了很久的“查询与赋值并存“”说明也没看得很明白,请版主指教!!!!!!谢谢先!!!!!!


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


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

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

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


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

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

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


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:31:00 [显示全部帖子]

对不起,我说不行的时候,是在您回答之前发的!!!!!!图片点击可在新窗口打开查看图片点击可在新窗口打开查看图片点击可在新窗口打开查看

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


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:37:00 [显示全部帖子]

主要是例子很大,我对编程写代码也不是很懂,所以老是要麻烦版主,再次表示感谢!有不懂的地方,我还要向版主讨教!

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


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:42:00 [显示全部帖子]

我对这段代码要进行修改,主要是点击按钮之后,要很长时间才会结束!

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


加好友 发短信
等级:二尾狐 帖子:531 积分:3216 威望:0 精华:0 注册:2014/12/2 9:23:00
  发帖心情 Post By:2015/7/28 10:44:00 [显示全部帖子]

我看说明里,1万行的记录才用了0.8秒,我这才几千行,要几分钟,这效率差太多了!

 回到顶部
总数 17 1 2 下一页