Foxtable(狐表)用户栏目专家坐堂 → [求助]数据引用


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

主题:[求助]数据引用

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/3/14 14:52:00 [显示全部帖子]

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

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/3/15 13:33:00 [显示全部帖子]

Select Case e.DataCol.name
    Case "供应商","暂收单号","材料代号"
        If e.DataRow.IsNull("材料代号") = False AndAlso e.DataRow.IsNull("供应商") = False AndAlso e.DataRow.IsNull("暂收单号") = False Then
            Dim nms() As String = {"外形尺寸_本体直径","外形尺寸_本体高","电容量测试值","损耗角正切测试值","漏电流测试值","材料代号"}
           
            Dim drs As List(of DataRow) = DataTables("电解电容检验记录数据库").Select("材料代号 = '" & e.DataRow("材料代号") & "'")
            systemready = False
            If drs.count <= 10 Then
                For Each dr As DataRow In drs
                    Dim dr2 As DataRow = e.DataTable.Addnew
                    For Each nm As String In nms
                        dr2(nm) =dr(nm)
                    Next
                    dr2("供应商") = e.DataRow("供应商")
                    drs("暂收单号") = e.DataRow("暂收单号")
                Next
               
            Else
                Dim i As Integer = 1
                Do
                    Dim Id As Integer = rand.Next(0,drs.count)
                    Dim dr5 As DataRow = drs(id)
                    Dim dr3 As DataRow = e.DataTable.Addnew
                    For Each nm As String In nms
                        dr3(nm) =dr5(nm)
                    Next
                    dr3("供应商") = e.DataRow("供应商")
                    dr3("暂收单号") = e.DataRow("暂收单号")
                    i += 1
                Loop While i <= 10
            End If
            e.DataRow.Delete
            systemready = True
        End If
    End  Select

 回到顶部