------订单表------
If e.DataCol.Name = "日期" Then
If e.DataRow.IsNull("日期") Then
e.DataRow("编号") = Nothing
Else
Dim bh As String = Format(e.DataRow("日期"),"yyyyMMdd") '取得编号的8位前缀
If e.DataRow("编号").StartsWith(bh) = False '如果编号的前8位不符
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(编号)","日期 = #" & e.DataRow("日期") & "# And [_Identify] <> " & e.DataRow("_Identify")) '取得该天的最大编号
If max > "" Then '如果存在最大编号
idx = CInt(max.Substring(9,3)) + 1 '获得最大编号的后三位顺序号,并加1
Else
idx = 1 '否则顺序号等于1
End If
e.DataRow("编号") = bh & "-" & Format(idx,"000")
End If
End If
End If
If e.DataCol.Name = "编号" Then '如果内容发生变动的是编号列
If e.NewValue Is Nothing Then '如果新值是空白,也就是品名列的内容为空
e.DataRow("店铺名") = Nothing '那么清空此行单价列的内容
Else
Dim dr As DataRow
'否则在产品表查找同名的产品行,将找到的行赋值给变量dr
dr = DataTables("订单明细表").Find("[店铺名] = '" & e.NewValue & "'")
If dr IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("店铺名") = dr("店铺名")
End If
End If
End If
----订单明细表----
If e.DataCol.Name = "店铺名"
Dim Filter As String = "[编号] = '" & e.DataRow("编号") & "'"
Dim drs As List(Of DataRow) = DataTables("订单表").Select(Filter)
For Each dr As DataRow In drs
dr("店铺名") = e.DataRow("店铺名")
Next
End If
试图这么操作,但是订单表里的店铺名列什么都不会显示。订单表里的店铺名列是数据列。