随机抽取少量行的标准代码:
Dim ids As String
Dim lst As new List(of String)
Dim cnt As Integer = DataTables("表A").DataRows.Count
Do
Dim Id As Integer = rand.Next(0,cnt)
id = DataTables("表A").DataRows(id)("_Identify")
If lst.Contains(id) =False Then
lst.Add(id)
End If
ids = ids & id & ","
Loop While lst.count < 5 '5是要抽取的行数
Tables("表A").Filter = "[_Identify] In (" & ids.Trim(",") & ")"
[此贴子已经被作者于2015/4/3 9:12:01编辑过]