If e.DataCol.Name = "入库日期" OrElse e.DataCol.Name = "出库日期" Then If e.DataRow.IsNull("入库日期") = False AndAlso e.DataRow.IsNull("出库日期") = False Then e.DataRow("天数") = DateDiff("d",e.DataRow("入库日期"),e.DataRow("出库日期")) Else e.DataRow("天数") = Nothing End If End If