vb.net Linq四表查询

前端之家收集整理的这篇文章主要介绍了vb.net Linq四表查询前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
Using MainDepthSelDataBinding As New DataClasses1DataContext("Data Source=PC2013030515PKF;Initial Catalog=song;Integrated Security=True")
            Dim A1 = From cust In MainDepthSelDataBinding.MainN
            Dim Count As New List(Of AA) From {}
            For Each x In A1
                Dim TempX = x
                Dim S1 = From cust In MainDepthSelDataBinding.Sec Where cust.secondNo1 = TempX.MainNo1
                Dim S2 = From cust In MainDepthSelDataBinding.Four Where cust.fourNo1 = TempX.MainNo3
                Dim S3 = From cust In MainDepthSelDataBinding.Third Where cust.thirdNo1 = TempX.MainNo2
                Dim A2 As New AA
                A2.No = TempX.id
                If S1.Any Then
                    A2.SX = S1.First.secondNo2
                End If

                If S2.Any Then
                    A2.YW = S2.First.fourNo2
                End If

                If S3.Any Then
                    A2.YY = S3.First.thirdNo2
                End If

                Count.Add(A2)
            Next

            DataGridView1.DataSource = Count


        End Using



Partial Class AA
    Property show1 As Integer = 0
    Property show2 As String = String.Empty
    Property show3 As String = String.Empty
    Property show4 As String = String.Empty
End Class
原文链接:/vb/258719.html

猜你在找的VB相关文章