Select e.DataCol.Name Case "群组分类" If e.DataRow.IsNull("群组分类") Then e.DataRow("客户ID") = Nothing Else Dim lb As String = e.DataRow("群组分类") Dim idx As Integer idx = e.DataTable.Compute("Max(客户ID)","群组分类 = '" & lb & "' And 编号<> " & e.DataRow("编号")) '取得该类别的最大编号 e.DataRow("客户ID") = idx + 1 End If End Select