Dim bh As String = "3020220023" Dim ids As String Dim lst As new List(of String) Dim drs As List(of DataRow) = DataTables("电解电容检验记录数据库").Select("材料代号 = '" & bh & "'") If drs.count < 10 Then msgbox("结果不足10个") Else Do Dim Id As Integer = rand.Next(0,drs.count) id = drs(id)("_Identify") If lst.Contains(id) =False Then lst.Add(id) End If ids = ids & id & "," Loop While lst.count <= 10 '5是要抽取的行数 msgbox(ids.trim(",")) End If
|