Dim dr As DataRow = e.DataRow
查询 Case e.DataCol.Name
Case "工费单号"
Dim dr2 As DataRow
'否则在产品表查找同名的工费单号行,将找到的行赋值给变量dr
dr2 = DataTables("应付对账单初表").Find("工费单号 = '" & e.NewValue & "'")
If dr2 IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("实工费") = 0
End If
End 查询
想实现填充数据时,如果本表工费单号列已存在与现在要填充的工费单号相同的行,则本行的实工费变更为0,但以上代码执行后无效,求老师帮忙看下是什么问题?但在表中手动修改工费单号列,实工费就能实现此功能
数据是通过以下类似代码实现
Dim cmd As
New
SQLCommand
Dim dt As
DataTable
Dim Cols1() As String = {"来源列一","来源列二","来源列三"}
Dim
Cols2() As
String = {"接收列一","接收列二","接收列三"}
cmd.CommandText =
"查询 * From {表A} Where 条件语句"
dt = cmd.ExecuteReader()
For
Each dr1 As DataRow In dt.DataRows
Dim
dr2 As DataRow = DataTables("表B").AddNew()
For i
As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) =
dr1(Cols1(i))
Next
Next
[此贴子已经被作者于2020/5/21 19:27:26编辑过]