Foxtable(狐表)用户栏目专家坐堂 → [求助]请大神指点考试自动排场次和排座次?


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

主题:[求助]请大神指点考试自动排场次和排座次?

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/5/22 17:25:00 [显示全部帖子]

参考

 

Dim dt As DataTable = DataTables("表A")
Dim cnt As Integer = dt.DataRows.Count
Dim ids(cnt - 1) As Integer
For i As Integer = 0 To cnt -1
    ids(i) = i
Next
For i As Integer = 0 To cnt \ 2 '洗牌次数
    Dim id1 As Integer = rand.Next(0,cnt)
    Dim id2 As Integer = rand.Next(0,cnt)
    Dim vid As Integer = ids(id1)
    ids(id1) = ids(id2)
    ids(id2) = vid
Next
dt.StopRedraw()
Dim cj As Integer = 1
Dim zc As Integer = 1
For i As Integer = 0 To ids.length -1
    dt.DataRows(ids(i))("场次") = cj
    dt.DataRows(ids(i))("座次") = zc
    If zc = 30 Then
        cj += 1
        zc = 0
    End If
    zc += 1
Next
dt.ResumeRedraw()


 回到顶部