Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I want filter row from data table when table date less then current date.
Posted

 
Share this answer
 
You can store data table in data view and apply filter on that and that bind object of data view at the place of data table.

C#
DataView dv;
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "Date < '"+DateTime.Now.ToString()+"'"; 


Don't forget to mark as answer if it helps. :)
 
Share this answer
 
v2
Comments
Amod Kumar Jaiswal 9-Dec-11 7:23am    
i did this.
it's filler all records from data table.
i want filter only date less then current date.
SQL
Dim x = From y In dt _
Where y("Date") = DateTime.Now _
                Select y("column1"), y("column2")



X will your I enumerable
 
Share this answer
 
to support the answer of Anuj please refer to this link: http://msdn.microsoft.com/en-us/library/bb669073.aspx[^] for the linq practices.
 
Share this answer
 
SQL
I want records of particular date only. Not to give time in condition criteria.
Please guide...


Dim fndRows() As DataRow

fndRows = DataSet1.TransactionTestMaster.Select("trandate='15/02/2014'")

TextBox4.Text = fndRows.Length


3 Records are in TransactionTestMaster table
TranDate ( Column Name)
1) 2014-02-15 16:51:00
2) 2014-02-15 17:45:00
3) 2014-04-16 17:48:00


I want records of particular date only. Not to give time in condition criteria.

Please guide...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900