以下是引用nidecan在2009-6-1 17:38:00的发言:
可以不加月份列吗?另外年份不能区别
将发放记录表的发放日期改成日期型。
发放记录表,DataColChanged事件代码。
Dim dr As DataRow =e.DataRow
if e.DataCol.Name ="发放日期" Then
if dr.IsNull("发放日期") Then
dr("工资") = Nothing
Else
Dim d As Date = dr("发放日期")
Dim Month As Integer = d.Month
Dim Year As Integer = d.Year
Dim StartDate As Date = New Date(Year,Month,1)
Dim EndDate As Date = New Date(Year,Month,Date.DaysInMonth(Year,Month))
dr("工资") = DataTables("人员表").Compute("sum(工资)", "[姓名] = '" & dr("姓名") & "' And [开始时间] >= #" & StartDate & "# And [开始时间] <= #" & EndDate & "#")
End If
End If