Foxtable(狐表)用户栏目专家坐堂 → [求助]下述代码,如何数据引用的年度相同,则不引用,否则引用,如何修改代码?


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

主题:[求助]下述代码,如何数据引用的年度相同,则不引用,否则引用,如何修改代码?

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/1 19:54:00 [显示全部帖子]

Dim Cols1() As String = {"姓名","现任职务","级别","个人状态","基本工资_保留奖金","补贴_保留福补","特岗津补贴","基本养老金","享受职务","单位性质","单位名称","年度","已休假天数","级别档次","个人类别","职务区分","岗位等级","薪级","身份证号","是否省级文明单位","是否全国文明城市","离休干部月均生活补贴","性别","参加工作时间"}


Dim Cols2() As String = {"姓名","现任职务","级别","个人状态","基本工资_保留奖金","补贴_保留福补","特岗津补贴","基本养老金","享受职务","单位性质","单位名称","年度","已休假天数","级别档次","个人类别","职务区分","岗位等级","薪级","身份证号","是否省级文明单位","是否全国文明城市","离休干部月均生活补贴","性别","参加工作时间"}


For Each dr1 As DataRow In DataTables("人员情况表").Select("[身份证号] is not null")
    Dim dr2 As DataRow = DataTables("工资总表").find("身份证号 = '" & dr1("身份证号") & "' and 年度 = '" & dr1("年度") & "'")
    If dr2 Is Nothing Then
        dr2 = DataTables("工资总表").AddNew()
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
        Next
    End If
Next


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/4/2 8:47:00 [显示全部帖子]

Dim Cols1() As String = {"姓名","现任职务","级别","个人状态","基本工资_保留奖金","补贴_保留福补","特岗津补贴","基本养老金","享受职务","单位性质","单位名称","年度","已休假天数","级别档次","个人类别","职务区分","岗位等级","薪级","身份证号","是否省级文明单位","是否全国文明城市","离休干部月均生活补贴","性别","参加工作时间"}
Dim Cols2() As String = {"姓名","现任职务","级别","个人状态","基本工资_保留奖金","补贴_保留福补","特岗津补贴","基本养老金","享受职务","单位性质","单位名称","年度","已休假天数","级别档次","个人类别","职务区分","岗位等级","薪级","身份证号","是否省级文明单位","是否全国文明城市","离休干部月均生活补贴","性别","参加工作时间"}
For Each dr1 As DataRow In DataTables("人员情况表").Select("[身份证号] is not null")
    Dim dr2 As DataRow = DataTables("工资总表").find("年度 = '" & dr1("年度") & "'")
    If dr2 IsNot Nothing Then
        MessageBox.Show("本年度已导入,不能再导入!","温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        Exit For
    End If
    If dr2 Is Nothing Then
        dr2 = DataTables("工资总表").AddNew()
        For i As Integer = 0 To Cols1.Length -1
            dr2(Cols2(i)) = dr1(Cols1(i))
        Next
    End If
Next

 回到顶部