Select Case e.DataCol.Name
Case "日期"
Dim d As Date =e.DataRow("日期")
If e.NewValue Is Nothing Then
e.DataRow("周") =Nothing
Else
e.DataRow("周") = System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(d, Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday).ToString
End If
Case "年","周","姓名"
If e.NewValue IsNot Nothing Then
e.DataRow("编码") = e.DataRow("年") & e.DataRow("周")& e.DataRow("姓名")
Else
e.DataRow("编码") = Nothing
End If
Case "编码"
If e.NewValue Is Nothing Then
e.DataRow("有效分摊") =Nothing
Else
e.DataRow("有效分摊") = DataTables("有效信息分摊").Compute("Count([编码])", "编码 = '" & e.NewValue & "'")
End If
如果放在这里是无法执行的
End Select
单独放在下面是可以执行的
Select Case e.DataCol.Name
Case "姓名"
Dim Products As List(Of String)
Products = DataTables("有效信息分摊").GetValues("广告费不分摊名单")
If Products.Contains(e.NewValue) Then
e.DataRow("费用分摊")= Nothing
Else
e.DataRow("费用分摊")= 1
End If
End Select