以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助] (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=63503) |
-- 作者:yjd -- 发布时间: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日的数据,程序报错年、月,日无法描述。版主您看是否是代码有问题。
|
-- 作者:有点甜 -- 发布时间: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 -- 发布时间: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 |