Foxtable(狐表)用户栏目专家坐堂 → 不能刷新


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

主题:不能刷新

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


加好友 发短信
等级:童狐 帖子:265 积分:1837 威望:0 精华:0 注册:2012/11/6 17:17:00
不能刷新  发帖心情 Post By:2013/3/11 14:40:00 [只看该作者]

我在表事件DataColChanged 写入代码:

 

If e.DataCol.Name = "身份证号码" Then '如果更改的是身份证号码列
    If e.DataRow.IsNull("身份证号码") Then '身份证号码是否为空
        e.DataRow("出生日期") = Nothing '如果为空,则清除出生日期
        e.DataRow("姓别") = Nothing
        e.DataRow("年龄") = Nothing
        e.DataRow("籍贯") = Nothing
        e.DataRow("服务天数") = Nothing
    Else  If ValidPIN(e.DataRow("身份证号码")) = True Then
        '否则从身份证号码列中提取出生日期
        e.DataRow("出生日期") = ReadBirthday(e.DataRow("身份证号码"))
        e.DataRow("姓别") = ReadSex(e.DataRow("身份证号码"))
        Dim st1 As String = Tables("员工表").Current("身份证号码")
        Dim st2 As String = st1.SubString(0,6)
        Dim dr As DataRow = DataTables("地区信息").Find("身份证区位码 = '" & st2 & "'")
        e.DataRow("籍贯") = dr("各地省市区")
    Else
        MessageBox.Show("您输入的身份证有误 , 或身份证可能是假的 !","警告",MessageBoxButtons.AbortRetryIgnore,MessageBoxIcon.Error)
        e.DataRow("出生日期") = Nothing '如果为空,则清除出生日期
        e.DataRow("姓别") = Nothing
        e.DataRow("身份证号码") = Nothing
    End If
End If

 


Select Case e.DataCol.name
    Case "入职日期","离职日期"
        If e.DataRow.IsNull("入职日期") Then
            e.DataRow("服务天数") = Nothing
        Else
            If e.DataRow.Isnull("离职日期") Then
                Dim tp As TimeSpan = Date.today - CDate(e.DataRow("入职日期"))
                e.DataRow("服务天数") =  Math.Round(tp.TotalDays)
            Else
                Dim tt As TimeSpan = cdate(e.DataRow("离职日期")) - cdate(e.DataRow("入职日期"))
                e.DataRow("服务天数") = math.round(tt.Totaldays)
            End If
        End If
        If e.DataRow.IsNull("出生日期") = False Then
            Dim tl As TimeSpan = Date.today - CDate(e.DataRow("出生日期"))
            e.DataRow("年龄") =  (Math.Round(tl.TotalDays)/365)
        End If
End Select

 

 

可以生成相关我需要的信息,但有时候不能更新,填入后不能及时生成,需要重置列方可以生成,求教


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


加好友 发短信
等级:等待验证 帖子:3855 积分:20692 威望:0 精华:5 注册:2012/6/21 14:03:00
  发帖心情 Post By:2013/3/11 14:48:00 [只看该作者]

用户已被锁定

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


加好友 发短信
等级:管理员 帖子:47448 积分:251048 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/3/11 15:29:00 [只看该作者]

你的年龄没办法自动刷新,应该这样:

 

Select Case e.DataCol.name
    Case "入职日期","离职日期"
        If e.DataRow.IsNull("入职日期") Then
            e.DataRow("服务天数") = Nothing
        Else
            If e.DataRow.Isnull("离职日期") Then
                Dim tp As TimeSpan = Date.today - CDate(e.DataRow("入职日期"))
                e.DataRow("服务天数") =  Math.Round(tp.TotalDays)
            Else
                Dim tt As TimeSpan = cdate(e.DataRow("离职日期")) - cdate(e.DataRow("入职日期"))
                e.DataRow("服务天数") = math.round(tt.Totaldays)
            End If
        End If
    Case "出生日期"
        If e.DataRow.IsNull("出生日期") = False Then
            Dim tl As TimeSpan = Date.today - CDate(e.DataRow("出生日期"))
            e.DataRow("年龄") =  (Math.Round(tl.TotalDays)/365)
        End If
End Select


 回到顶部