If e.DataCol.Name = "入院日期" And e.Datarow.IsNull("入院日期") = False Then Dim dt As Date = e.DataRow("入院日期") '获得输入的日期 '计算编号 e.Datarow("患者ID") = Format(dt,"yyMMdd") & Format(e.DataTable.Compute("Count(入院日期)", "[入院日期] = #" & dt & "# And [_identify] < " & e.DataRow("_Identify")) + 1,"000") End If