You must Sign In to post a response.
  • Category: Visual Studio

    LINQ query in 2008

    Hi friends,

    I need to know how to use LINQ query where in my datatable contains a date column.
    I need to use'BETWEEN' operator in LINQ query and pass two dates to the data table and filter the details.

    Can anyone help me in this regards.

    Thanks in Advance
  • #752365

  • #752370
    Hai Lakshmi,
    Instead of using BETWEEN operator, you can use >= and <= which will have the correct results.
    Below is an example of filtering the records between two dates:

    Dim filteredRecords = (From obj in collection
    Where(obj.Date >= FromDate
    and obj.Date <= ToDate)
    Select obj.Date).Distinct()

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • Sign In to post your comments