Accessing data using Language Integrated Query in VB.NET

In this article you will learn how to Access data using Language Integrated Query (LINQ).
  • 1709

Language Integrated Query(LINQ) is a set of operators which allow traversal,projection operations,filter  in Visual Basic Programming language. It works in three steps : Obtain the source of data, Create the query and Query execution.

At the time of execution data is created by this query not retrieved.

By this simple example I am try to explain how a query works in this example. This query retrieves those numbers which is greater than 5.

Module Module1

    Sub Main()
        Dim numbers As Integer() = New Integer(9) {0, 1, 2, 3, 4, 5, 6, 8, 9,10}
        Dim numQuery As IEnumerable(Of Integer) = Fromnum In numbers
         Where (num Mod2) = 0
         Select num
        For EachAs Integer In numQuery
            Console.Write("{0,1} ", j)
        
Next
        Console.ReadLine()
    End 
Sub

End
 Module

OUTPUT:

1.gif
 

 

 

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.