c# datatable select statement with dates

后端 未结 5 1359
难免孤独
难免孤独 2021-01-12 06:16

i am trying to make a select statement on a datatable to get the row that is within the date range i am looking for. I am new to this an i dont quite understand how this sel

5条回答
  •  [愿得一人]
    2021-01-12 06:42

    This the Best Optimal Search Criteria I have Tested. you having to dates.

    From_Date = 12/01/2012 To_Date = 12/31/2012

    and Your column in DataTable upon which you applying . (in my code 'date')

    Your Select Statement will be like this.

      DataRow[] rows = newTable.Select("date >= #" + from_date + "# AND date <= #" + to_date + "#");
    

提交回复
热议问题