Foxtable(狐表)用户栏目专家坐堂 → [求助]


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

主题:[求助]

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


加好友 发短信
等级:幼狐 帖子:183 积分:1434 威望:0 精华:0 注册:2014/11/7 21:15:00
[求助]  发帖心情 Post By:2015/1/22 13:31:00 [只看该作者]

Dim nms As String
Dim n As Integer = 6 '未来天数,含今天,所以实际是未来7天
For Each dr As DataRow In DataTables("对私客户明细").DataRows
    Dim dt As Date = dr("生日")
    Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day)
    Dim dt2 As  New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
    If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
        nms = nms & ",'" & dr("身份证号") & "'"
    End If
Next
If nms > "" Then
    nms = nms.Trim(",")
    Tables("对私客户明细").filter = "[身份证号] In (" & nms &")"
End If

如果身份证号有2月29日的数据,程序报错年、月,日无法描述。版主您看是否是代码有问题。

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2015/1/22 14:03:00 [只看该作者]

Dim nms As String
Dim n As Integer = 6 '未来天数,含今天,所以实际是未来7天
For Each dr As DataRow In DataTables("对私客户明细").DataRows
    Dim dt As Date = dr("生日")
    Dim dt1 As Date
    Dim dt2 As Date
    If dt.Month = 2 AndAlso dt.Day = 29 Then
        dt1 = New Date(Date.Today.Year,dt.Month,28)
        dt2 = New Date(Date.Today.AddDays(n).Year,dt.Month,28)
    Else
        dt1 = New Date(Date.Today.Year,dt.Month,dt.Day)
        dt2 = New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
    End If
   
    If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
        nms = nms & ",'" & dr("身份证号") & "'"
    End If
Next
If nms > "" Then
    nms = nms.Trim(",")
    Tables("对私客户明细").filter = "[身份证号] In (" & nms &")"
End If

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


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2015/1/22 14:08:00 [只看该作者]

Dim dt As Date = dr("生日")
if dt.month =2 andalso dt.day=29 andalso Date.IsLeapYear(date.today.year)=false then
    '特殊日期
else
  Dim dt1 As New Date(Date.Today.Year,dt.Month,dt.Day)
    Dim dt2 As  New Date(Date.Today.AddDays(n).Year,dt.Month,dt.Day)
    If (dt1 >= Date.Today AndAlso dt1 < Date.Today.AddDays(n)) OrElse (dt2 >= Date.Today AndAlso dt2 < Date.Today.AddDays(n)) Then
        nms = nms & ",'" & dr("身份证号") & "'"
    End If
end if

 回到顶部