Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:到期提示

1楼
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

2楼
狐狸爸爸 发表于: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) )

3楼
tungwun 发表于:2011/10/28 11:47:00
代码没有做到30天内到期资料 如今天2011-10-28至2011-11-26内资料?

代码中Dm写成Dim?
4楼
狐狸爸爸 发表于: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) )

共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02148 s, 2 queries.