dim f As New Filler f.SourceTable = DataTables("档案") '指定数据来源 f.SourceCols = "姓名" '指定数据来源列 f.DataTable = DataTables("主管") '指定数据接收表 f.ExcludeExistValue = true f.DataCols = "姓名" '指定数据接收列 f.filter = "[在职情况] = '在岗'" f.Fill() '填充=据 For Each dr As DataRow In DataTables("主管").DataRows if dr.IsNull("日期") Then dr("日期") = e.Form.Controls("日期").Value dr("备注") = "请假" End If Next
3楼
wqc360 发表于:2009/12/21 11:53:00
不行,日期改变时,不再填充,没有日期对比
4楼
czy 发表于:2009/12/21 11:56:00
Dim d As Date = Forms("窗口1").Controls("日期").Value For Each dr1 As DataRow In DataTables("档案").DataRows Dim dr As DataRow = DataTables("主管").Find("姓名 = '" & dr1("姓名") & "' And 日期 = '" & d & "'") if dr Is Nothing Then Dim dr2 As DataRow = DataTables("主管").AddNew() dr2("日期") = d dr2("姓名") = dr1("姓名") dr2("备注") = "请假" End If Next
5楼
wqc360 发表于:2009/12/21 12:06:00
还是不对,没有排除在职情况
6楼
czy 发表于:2009/12/21 12:08:00
你加个判断不就行了。
7楼
czy 发表于:2009/12/21 12:17:00
还是帮你搞定吧。
Dim d As Date = Forms("窗口1").Controls("日期").Value Dim drs As List(Of DataRow) = DataTables("档案").Select("[在职情况] = '在岗'") For Each dr1 As Datarow In drs Dim dr As DataRow = DataTables("主管").Find("姓名 = '" & dr1("姓名") & "' And 日期 = '" & d & "'") if dr Is Nothing Then Dim dr2 As DataRow = DataTables("主管").AddNew() dr2("日期") = d dr2("姓名") = dr1("姓名") dr2("备注") = "请假" End If Next