求教一下,临时表可以设置关联表不,这是我写的代码,麻烦看下,改如何改进下:If Relations.Contains("po") = True Then
Relations.Delete("po")
Else
Dim cmd As new SQLCommand
Dim dt_临时表 As DataTable
cmd.C
cmd.CommandText = "S elect '201706' as 核算月份,工号,保底工资 f rom {GZ_基础薪酬设置} where 保底工资 is not null and 停止核算 =0"
dt_临时表 = cmd.ExecuteReader
Dim dt_工资明细 As DataTable = DataTables("GZ_工资明细")
Dim ParentCol(1) As DataCol
Dim ChildCol(1) As DataCol
ParentCol(0) = dt_临时表.DataCols("工号")
ParentCol(1) = dt_临时表.DataCols("核算月份")
ChildCol(0) = dt_工资明细.DataCols("工号")
ChildCol(1) = dt_工资明细.DataCols("核算月份")
Relations.Add("po", ParentCol, ChildCol)
If dt_工资明细.DataCols.Contains("保底工资") = False Then
dt_工资明细.DataCols.Add("保底工资", Gettype(String),"Parent(po).保底工资")
End If
End If
[此贴子已经被作者于2018/7/28 11:32:32编辑过]