Get Data between DateTime period from DataTable
Posted on 2012-12-29
I am working on ASP.net4.0 using C#
I have a DataTable having column "Creation Date", which is of DateTime type
Now I have advance search option where user can select from date and To date in dd/MM/yyyy format (i.e., 29//12/2012)
From my datatable I want to select data from my DataTable, based on from and to creatation date.
If I have to find data based on string I do as below:
dt2.Select("Owner = 'XYZ'");
where dt2 is my DataTable.
Please help me to add another from and to date criteria in my above query, so that query should look like something
string fromDate = "10/12/2012";
string fromDate = "20/12/2012";
In DataTable I have column "Creation Date" of DateTime type
dt2.Select("Owner = 'XYZ' AND (COMPARE DATE HERE)");