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

    LINQ query in vb.net 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
    http://stackoverflow.com/questions/767503/how-can-i-query-the-range-of-date-which-one-product-has-not-been-ordered-linq

  • #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.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


  • Sign In to post your comments