你要的不是第一个,而是倒数第一个,Find的帮助其实对此有说明的: Dim dr As DataRow = e.DataRow Select Case e.DataCol.Name Case "物料编码" If dr.IsNull("物料编码") = False Then Dim dr1,dr2 As DataRow dr1 = DataTables("表A").Find("[物料编码] = '" & e.DataRow("物料编码") & "' and [_Identify] < '" & e.DataRow("_Identify") & "'", "[_Identify] Desc") If dr1 IsNot Nothing Then dr("库存") = dr1("出货后库存") End If Else dr("库存") = Nothing End If End Select
|