Foxtable(狐表)用户栏目专家坐堂 → [求助]代码出错,求助修改(已解决)


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

主题:[求助]代码出错,求助修改(已解决)

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


加好友 发短信
等级:狐神 帖子:6708 积分:34304 威望:0 精华:11 注册:2012/8/18 23:10:00
  发帖心情 Post By:2012/9/17 11:39:00 [显示全部帖子]

 代码如下

Dim drs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂'", "考核分 desc")

Dim count As Integer = 1
For Each dr As DataRow In drs
    dr("名次") = count
    count = count + 1
Next

Dim dr3 As DataRow = DataTables("考核名次").Find("名次 = 3 And 厂家 = '一分厂'")
Dim dr5 As DataRow = DataTables("考核名次").Find("名次 = 5 And 厂家 = '一分厂'")
Dim drMin As DataRow = DataTables("考核名次").Find("名次 = " & count - 1 & " And 厂家 = '一分厂'")
Dim odrs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂' And 名次 > 5", "考核分 desc")

drs = DataTables("考核名次").Select("厂家 = '二分厂'")
For Each dr As DataRow In drs
    If dr("考核分") >= dr3("考核分") Then
        dr("名次") = 3
    Else If dr("考核分") >= dr5("考核分") Then
        dr("名次") = 5
    Else If dr("考核分") >= drMin("考核分") Then
        For Each odr As DataRow In odrs
            If dr("考核分") >= odr("考核分") Then
                dr("名次") = odr("名次")
                Exit For
            End If
        Next
    Else
        dr("名次") = count - 1
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
lin_hailun
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:6708 积分:34304 威望:0 精华:11 注册:2012/8/18 23:10:00
  发帖心情 Post By:2012/9/17 14:23:00 [显示全部帖子]

 哦哦,忘记你第一行是空值了。

Dim drs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂'", "考核分 desc")

Dim count As Integer = 1
For Each dr As DataRow In drs
    dr("名次") = count
    count = count + 1
Next

Dim dr3 As DataRow = DataTables("考核名次").Find("名次 = '3' And 厂家 = '一分厂'")
Dim dr5 As DataRow = DataTables("考核名次").Find("名次 = '5' And 厂家 = '一分厂'")
Dim drMin As DataRow = DataTables("考核名次").Find("名次 = '" & count - 1 & "' And 厂家 = '一分厂'")
Dim odrs As List(Of DataRow) = DataTables("考核名次").Select("厂家 = '一分厂' And 名次 > 5", "考核分 desc")

drs = DataTables("考核名次").Select("厂家 = '二分厂'")
For Each dr As DataRow In drs
    If dr("考核分") >= dr3("考核分") Then
        dr("名次") = 3
    Else If dr("考核分") >= dr5("考核分") Then
        dr("名次") = 5
    Else If dr("考核分") >= drMin("考核分") Then
        For Each odr As DataRow In odrs
            If dr("考核分") >= odr("考核分") Then
                dr("名次") = odr("名次")
                Exit For
            End If
        Next
    Else If dr("厂家") <> "" Then
        dr("名次") = count - 1
    End If
Next


 回到顶部