Forum guidelines
AuthorQuestion
Dataview RowFilter using date range
Posted on: 30 Apr 2011
Hi Guys

Always datetime operation needs special care while doing coding
While coding recently i have suffered to use Row filter using Date range

I have set of rows in datatable and i convert it to dataview and
have to filter rows between two date range

Can anyone show the sample code pls

Narasimman
AuthorReply
Re: Dataview RowFilter using date range
Posted on: 30 Apr 2011  
Yes, you are right it needs special care.

find the sample code here, once upon a time this helped me lot

http://www.csharp-examples.net/dataview-rowfilter/


hope this helps

  Microsoft MVP     C# Corner MVP    Blog: http://www.itorian.com

Re: Dataview RowFilter using date range
Posted on: 30 Apr 2011  
just write your date inside #Date Here # instead of writing in ' ' (Single Quotes )

MY BLOG ( www.codestructs.com ) | MY SITE

Kirtan
 Patel   BCA   MCA (SEMESTER-IV)  MINDCRACKER MVP WEB HACKER



Re: Dataview RowFilter using date range
Posted on: 30 Apr 2011  
@Abimanyu
Thanks for the response

Already i have seen that link, there they explained only to filter using single date

I want to filter between range such as we use in sql
Datetime Between '1984-01-01 00:00:00' And '1986-1-1 00:00:00';

@kirtan

Thanks for the response
I know the format to enclose the dates but how to filter rows between two date ranges






Narasimman
Re: Dataview RowFilter using date range
Posted on: 30 Apr 2011  
If 'Date' is the name of your column, I'd try something like:

dataView.RowFilter = "Date >= #1//1/1984# AND Date <= #1/1/1986#";

Re: Dataview RowFilter using date range
Posted on: 30 Apr 2011  
filteringrecordondate.rar Ok....
I have an already working sample but little different than your issue. Please check out, may will help you.

thanks

  Microsoft MVP     C# Corner MVP    Blog: http://www.itorian.com

SPONSORED BY

Offshore Software and Database Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.