vb.net Linq四表查询

前端之家收集整理的这篇文章主要介绍了vb.net Linq四表查询前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. Using MainDepthSelDataBinding As New DataClasses1DataContext("Data Source=PC2013030515PKF;Initial Catalog=song;Integrated Security=True")
  2. Dim A1 = From cust In MainDepthSelDataBinding.MainN
  3. Dim Count As New List(Of AA) From {}
  4. For Each x In A1
  5. Dim TempX = x
  6. Dim S1 = From cust In MainDepthSelDataBinding.Sec Where cust.secondNo1 = TempX.MainNo1
  7. Dim S2 = From cust In MainDepthSelDataBinding.Four Where cust.fourNo1 = TempX.MainNo3
  8. Dim S3 = From cust In MainDepthSelDataBinding.Third Where cust.thirdNo1 = TempX.MainNo2
  9. Dim A2 As New AA
  10. A2.No = TempX.id
  11. If S1.Any Then
  12. A2.SX = S1.First.secondNo2
  13. End If
  14.  
  15. If S2.Any Then
  16. A2.YW = S2.First.fourNo2
  17. End If
  18.  
  19. If S3.Any Then
  20. A2.YY = S3.First.thirdNo2
  21. End If
  22.  
  23. Count.Add(A2)
  24. Next
  25.  
  26. DataGridView1.DataSource = Count
  27.  
  28.  
  29. End Using



  1. Partial Class AA
  2. Property show1 As Integer = 0
  3. Property show2 As String = String.Empty
  4. Property show3 As String = String.Empty
  5. Property show4 As String = String.Empty
  6. End Class

猜你在找的VB相关文章