以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 到期提示 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=13809) |
-- 作者:tungwun -- 发布时间:2011/10/28 10:07:00 -- 到期提示 请问以下代码可否做到提示30天内所有到期的车牌号码? Dim ids As String Dim cnt As Integer Dim nms As String For Each dr As DataRow In DataTables("车牌资料").DataRows Dim dt As Date = dr("到期日") If Date.Today.AddDays(30) = dt Then cnt = cnt + 1 ids = ids & "," & dr("_Identify") nms = nms & "," & dr("车牌号码") End If Next If cnt > 0 Then messagebox.show("有" & cnt & "车牌30日後到期,分別是: " & nms.Trim(",")) Tables("车牌资料").filter = "[_Identify] In (" & ids.Trim(",") &")" End If |
-- 作者:狐狸爸爸 -- 发布时间:2011/10/28 10:23:00 -- 你搞得太复杂了。
Dim flt As String = "到期日 <= #" & Date.Today.AddDays(30) & "#" Tables("车牌资料").filter = flt Dm nms as list(of String) = DataTables("车牌资料").GetUniqueValues(flt,"车牌号码") messagebox.show("有" & nms.Count & "30日後到期,分别是:" & String.Join("|", nms.Toarray) ) |
-- 作者:tungwun -- 发布时间:2011/10/28 11:47:00 -- 代码没有做到30天内到期 代码没有做到30天内到期资料 如今天2011-10-28至2011-11-26内资料? 代码中Dm写成Dim?
|
-- 作者:狐狸爸爸 -- 发布时间:2011/10/28 11:51:00 -- Dim flt As String = “到期日 >= #" & Date.Today & "# And 到期日 <= #" & Date.Today.AddDays(30) & "#" Tables("车牌资料").filter = flt Dim nms as list(of String) = DataTables("车牌资料").GetUniqueValues(flt,"车牌号码") messagebox.show("有" & nms.Count & "30日後到期,分别是:" & String.Join("|", nms.Toarray) ) |