本周
Dim y As Integer = Date.Today.Year
Dim w As Integer = Date.Today.DayOfWeek '算出今天是星期几
Dim dt As Date = Date.Today.AddDays(-w+1) '获取本周的第一天
For i As Integer = 0 To 6
Dim ndr As DataRow = DataTables("派工表").AddNew
ndr("日期") = dt.AddDays(i)
ndr("新老客户") = "老客户"
Next
下周
Dim y As Integer = Date.Today.Year
Dim w As Integer = Date.Today.DayOfWeek '算出今天是星期几
Dim dt As Date = Date.Today.AddDays(-w+1).AddDays(7) '获取本周的第一天
For i As Integer = 0 To 6
Dim ndr As DataRow = DataTables("派工表").AddNew
ndr("日期") = dt.AddDays(i)
ndr("新老客户") = "老客户"
Next