以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  加载本月与本周,代码怎么写?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=26498)

--  作者:zhfe0573
--  发布时间:2012/12/6 13:12:00
--  加载本月与本周,代码怎么写?
SQL SERVER数据源:

DataTables("订单").LoadFilter = "[日期] = \'" &Date.Today & "\'"
DataTables(
"订单").Load

 

如果是加载本月与本周, &Date.Today & 这里怎么写?


--  作者:飞
--  发布时间:2012/12/6 14:09:00
--  

本月

DATEDIFF(m,日期,GETDATE()) = 0

本周

DATEDIFF(ww,日期,GETDATE()) = 0

 

见此处

http://www.foxtable.com/help/index.html?n=1508.htm

 

[此贴子已经被作者于2012-12-6 17:35:49编辑过]

--  作者:lin_hailun
--  发布时间:2012/12/6 14:35:00
--  
 复杂一点这样。

 http://www.foxtable.com/help/topics/0229.htm

 http://www.foxtable.com/help/topics/0265.htm


Dim d As Integer = Date.Today.DayOfWeek
"日期 >= \'" & Date.Today.AddDays(-d) & "\' And 日期 < \'" & Date.Today.AddDays(8-d) & "\'"

Dim start As Date =
New Date(Date.Today.Year, Date.Today.Month, 1)
"日期 >= \'" & start & "\' And 日期 < \'" & start.AddDays(Date.DaysInMonth(start.Year, start.Month)) & "\'"
[此贴子已经被作者于2012-12-6 14:36:24编辑过]

--  作者:zhfe0573
--  发布时间:2012/12/6 18:20:00
--  
解决了,非常感谢