Select Case e.DataCol.Name
Case "单位","岗位"
If e.DataRow.IsNull("日期") = False AndAlso e.DataRow("单位") = "安全科" AndAlso e.DataRow("岗位") = "安检科科长" Then
If e.DataRow.GetChildRows("责任制明细").Count = 0 Then
Dim dr As DataRow = DataTables("责任制明细").AddNew()
dr("日期")=e.DataRow("日期")
dr("单位")=e.DataRow("单位")
dr("岗位")="安检科科长"
dr("姓名")=""
dr("考核内容")="认真贯彻党和国家安全生产方针、政策、法律、法规,在安全矿长的领导下,负责矿井安全监督检查工作,是本科室安全第一责任者."
dr("总分")="10"
End If
End If
End Select
1.老师我有一个表 有很多条上面这个代码 在代码编辑框里 下拉都不正常 拉不到底 太多了 几千行了
2.还有一个问题是 每个月都会生成一次表 速度越来越慢 是不是和下面这个代码有关系 老师给帮忙优化一下
责任制明细_DataColChanging
Dim t As Table = Tables("责任制明细")
t.Sort = "日期,岗位,考核内容,单位"
If t.Rows.Count > 1 Then
Dim r As Row = t.Rows(t.Rows.Count - 1)
For i As Integer = t.Rows.Count - 2 To 0 Step -1
Dim r1 As Row = t.Rows(i)
If r("姓名") = r1("姓名") And r("岗位") = r1("岗位") And r("考核内容") = r1("考核内容") And r("日期") = r1("日期") And r("单位") = r1("单位") Then
r1.Delete
Else
r = r1
End If
Next
End If