Select Case e.DataCol.Name Case "订单编号" If e.DataRow.IsNull("订单编号") = False Then '如果已经输入订单编号 If e.DataRow.GetChildRows("订单明细").Count = 0 Then '而且无订单明细 Dim dr As DataRow = DataTables("订单明细").AddNew() dr("订单编号") = e.DataRow("订单编号") End If End If End Select