Foxtable(狐表)用户栏目专家坐堂 → [求助]用得很好的代码突然报错……


  共有4294人关注过本帖树形打印复制链接

主题:[求助]用得很好的代码突然报错……

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/9/27 17:04:00 [显示全部帖子]

判断一下,有符合条件的行才执行:
 
Dim dt As DataTable = DataTables("异动总表")
Dim nums As List(Of String) = dt.GetUniqueValues("学号 is not null", "学号")
Dim idxs As String = ""
For Each num As String In nums
    Dim drs As List(Of DataRow) = dt.Select("学号 = '" & num & "'", "异动日期")
    For i As Integer = drs.Count - 2 To 0 Step -1
        Dim bf As DataTable = DataTables("异动备份")
        Dim ndr As DataRow = bf.AddNew()
        For Each c As DataCol In bf.DataCols
            ndr(c.Name) = drs(i)(c.Name)
        Next
        idxs = idxs & drs(i)("_Identify") & ","
    Next
Next
If idxs > "" Then
    dt.DeleteFor("[_Identify] in (" & idxs.Trim(",") & ")")
End If

 回到顶部