Dim m,n As Integer Select Case e.DataCol.name Case "备注","开始日期", "结束时间" If e.DataRow.isnull("备注") = false Then m = e.DataRow("备注").split(",").Length End If If e.DataRow.IsNull("开始日期") = False AndAlso e.DataRow.IsNull("结束时间") = False n = DateDiff("d",e.DataRow("开始日期"),e.DataRow("结束时间")) + 1 End If e.DataRow("合计") = m + n End Select