不知道那里问题,帮助我看一下,条件总是不成立?
代码:
Select Case e.DataCol.Name
Case "物料编码"
Dim bv() As String = {"物料名称","物料规格","计量单位","物料图号","单重"}
For Each bvn As String In bv
If e.NewValue Is Nothing Then
e.DataRow(bvn) = Nothing
Else
Dim qw As DataRow = DataTables("物料清单").Find("[物料编码]= '" & e.NewValue & "'")
Dim pr As DataRow = e.DataRow.GetParentRow("外协加工")
Dim q As Date = pr("日期")
'可以运行代码:Dim qw1 As DataRow = DataTables("产品价格表").Find("[物料编码]= '" & e.NewValue & "'and [开始时间] >= #01/01/2016# And [结束时间] <= #12/31/2016#")
Dim qw1 As DataRow = DataTables("产品价格表").Find("[物料编码]= '" & e.NewValue & "'and [开始时间] >= #" & q & "# And [结束时间] <= #" & q & "#")
If qw IsNot Nothing Then
e.DataRow(bvn) = qw(bvn)
End If
If qw1 IsNot Nothing Then
e.DataRow("加工单价") = qw1("价格")
Else
MessageBox.Show(q) '测试代码
End If
End If
Next
End Select
[此贴子已经被作者于2016/3/7 10:38:31编辑过]