以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 老师麻烦看一下代码错在哪 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=142154) |
||
-- 作者:ls93005 -- 发布时间:2019/10/19 21:10:00 -- 老师麻烦看一下代码错在哪 If GangWeiLei = 3 Then Dim LinShi As List(of DataRow) = DataTables("评分临时录入表").Select("") Dim BuMen As String = DataTables("岗位及人员明细表").Find("姓名 = \'" & Name & "\'" )("隶属部门") Dim LingDao As String = DataTables("部门信息表").Find("部门编码 = \'" & Bumen & "\'" )("分管领导") Dim FeiLingDaos As List(of DataRow) = DataTables("岗位及人员明细表").Select("岗位类 = 2 And 姓名 <> \'" & LingDao & "\' ") Dim flds As New List(of String ) For Each fld As DataRow In FeiLingDaos flds.Add(fld("姓名")) Next For Each ls As DataRow In LinShi For Each fld As String In flds If ls("被评测人") = fld Then ls.Delete End If Next Next End If 运行就提示“此行已从表中移除并且没有任何数据。BeginEdit() 将允许在此行中创建新数据”
|
||
-- 作者:ls93005 -- 发布时间:2019/10/19 21:14:00 -- Dim FeiLingDaos As List(of DataRow) = DataTables("岗位及人员明细表").Select("岗位类 = 2 And 姓名 <> \'" & LingDao & "\' ") For Each fld As DataRow In FeiLingDaos For Each ls As DataRow In LinShi If ls("被评测人") = fld("姓名") Then ls.Delete End If Next Next |
||
-- 作者:有点酸 -- 发布时间:2019/10/19 22:38:00 -- Dim FeiLingDaos As List(of DataRow) = DataTables("岗位及人员明细表").Select("岗位类 = 2 And 姓名 <> \'" & LingDao & "\' ") For Each fld As DataRow In FeiLingDaos DataTables("评分临时录入表").DeleteFor("被评测人 = \'" & fld(“姓名”) & “‘”) Next Next
|
||
-- 作者:ls93005 -- 发布时间:2019/10/20 0:03:00 -- 那这一段总是提示没有引用到实例。我看到是第二次循环为控制 Dim mxtb As DataTable = DataTables("评测分数明细表") Dim zgtb As DataTable = DataTables("职工表") Dim ZhiGongL As List(of DataRow) = zgtb.Select("") For Each ZG As DataRow In ZhiGongL Dim RQ As Date = mxtb.Find("评分人 = \'" & zg("职工姓名") & "\'","评测年月 Desc")("评测年月") If RQ <> Nothing Then zg("评测表最后打分时间") = RQ End If Next 要怎么避免错误提示?
|
||
-- 作者:hc-mall -- 发布时间:2019/10/20 1:58:00 --
|
||
-- 作者:有点蓝 -- 发布时间:2019/10/20 21:51:00 --
For Each ZG As DataRow In zgtb.datatows Dim RQ As DataRow = mxtb.Find("评分人 = \'" & zg("职工姓名") & "\'","评测年月 Desc") If RQ isnot Nothing Then zg("评测表最后打分时间") = RQ("评测年月") End If Next
|