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


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

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

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


加好友 发短信
等级:五尾狐 帖子:1142 积分:8900 威望:0 精华:0 注册:2012/7/10 9:09:00
[求助]下述代码,如何数据引用的年度相同,则不引用,否则引用,如何修改代码?  发帖心情 Post By:2018/4/1 16:13:00 [显示全部帖子]

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

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

For Each dr1 As DataRow In DataTables("人员情况表").Select("[身份证号] <> ''")
    Dim dr2 As DataRow = DataTables("工资总表").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next


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


加好友 发短信
等级:五尾狐 帖子:1142 积分:8900 威望:0 精华:0 注册:2012/7/10 9:09:00
  发帖心情 Post By:2018/4/2 7:27:00 [显示全部帖子]

有点甜,谢谢了,但是上述代码,第一次导入的是2018年的,然后,我要导入2019年时,2018年的不导入,只导入2019年的,怎么修改代码,谢谢

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


加好友 发短信
等级:五尾狐 帖子:1142 积分:8900 威望:0 精华:0 注册:2012/7/10 9:09:00
  发帖心情 Post By:2018/4/2 7:29:00 [显示全部帖子]

明白了,弄好了,把身份证去掉,就可以了


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


加好友 发短信
等级:五尾狐 帖子:1142 积分:8900 威望:0 精华:0 注册:2012/7/10 9:09:00
  发帖心情 Post By:2018/4/2 7:53: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)
Return
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


 回到顶部