Dim dr As DataRow=e.DataRow If e.DataCol.Name = "分组" Then If dr.IsNull("分组") Then dr("父键") = Nothing dr("主键")= Nothing dr("名称")=Nothing Else Dim txt As String = dr("分组") Dim dr1 As DataRow dr1= DataTables("主表").find("[分组]='" & txt & "' and _Identify <> " & dr("_Identify")) If dr1 IsNot Nothing Then dr("父键")= dr1("父键") Else Dim max As String = e.DataTable.Compute("Max(父键)") Dim idx As Integer If max > "" Then idx = CInt(max)+1 MessageBox.Show(idx) Else idx=1 End If dr("父键")=Format(idx,"00") End If End If End If
|