帮助文档这样写,有问题,洗牌,不是这样洗的。
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()
For i As Integer = 0 To ids.length -1
output.show(ids(i))
Next
dt.ResumeRedraw()