Select Case e.DataCol.Name Case "开学日期","放假日期" If e.DataRow.IsNull("开学日期") OrElse e.DataRow.IsNull("放假日期") Then e.DataRow("本学期月数") = Nothing Else Dim y,m,d As Integer Dim 开学日期 As Date = e.DataRow("开学日期") Dim 放假日期 As Date = e.DataRow("放假日期") DateYMD(开学日期,放假日期,y,m,d) e.DataRow("本学期月数") = y * 12 + m + iif(d<10, 0, iif(d<20,0.5,1)) End If End Select