Select Case e.DataCol.name Case "起始时间","结束时间" Dim dr As DataRow = e.DataRow If dr.IsNull("起始时间") Or dr.IsNull("结束时间") Then dr("本次用时") = Nothing Else Dim tp As TimeSpan tp = dr("结束时间") - dr("起始时间") If tp.TotalSeconds < 0 Then tp.add(new timespan(24,0,0)) End If dr("本次用时") = tp.TotalSeconds() '真正的时段型数据要转换为秒数,才能存入时段列 End If End Select