以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于手工编号填充数据,出现重复 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179849) |
-- 作者:johnny8306 -- 发布时间:2022/9/13 23:36:00 -- 关于手工编号填充数据,出现重复 老师好,我有两个问题 第1个问题,"考勤表"的datacolchanged事件设置了手工编号填充数据,但是在表"GZFFB"中出现了大量重复的数据,请问我应该如何修改代码? 第2个问题,请问在项目事件的datacolchanged事件中如何设置,让表"考勤表"和"GZFFB"同步更新呢? 谢谢 "考勤表"的datacolchanged事件设置,如下: Dim Vals As List(Of String()) Vals = DataTables("考勤表").GetValues("时段|工号|ID|姓名|岗位|入职时间|日薪|天数|加班费|MPESA") For i As Integer = 0 To Vals.Count - 1 Dim dr As DataRow = DataTables("GZFFB").AddNew() dr("时段") = Vals(i)(0) dr("工号") = Vals(i)(1) dr("ID") = Vals(i)(2) dr("姓名") = Vals(i)(3) dr("岗位") = Vals(i)(4) dr("入职时间") = Vals(i)(5) dr("日薪") = Vals(i)(6) dr("天数") = Vals(i)(7) dr("加班费") = Vals(i)(8) dr("MPESA") = Vals(i)(9) Next |
-- 作者:有点蓝 -- 发布时间:2022/9/14 8:59:00 -- 参考:http://www.foxtable.com/webhelp/topics/1451.htm "GZFFB"datacolchanged事件 If e.DataCol.Name = "工号" Then Dim nms() As String = {"时段","ID","......} If e.NewValue Is Nothing Then For Each nm As String In nms e.DataRow(nm) = Nothing Next Else Dim dr As DataRow dr = DataTables("考勤表").Find("[工号] = \'" & e.NewValue & "\'") If dr IsNot Nothing For Each nm As String In nms e.DataRow(nm) = dr(nm) Next End If End If End If "考勤表"的datacolchanged事件 Select Case e.DataCol.Name Case "时段","ID","...... Dim dr As DataRow = e.DataRow Dim pr As DataRow Dim filter As String filter = "工号 = \'" & dr("工号") & "\'" pr = DataTables("GZFFB").Find(filter) If pr Is Nothing Then pr = DataTables("GZFFB").addnew pr("工号") = dr("工号") End If pr(e.DataCol.Name) = dr(e.DataCol.Name) End Select
|