[Last Call] Learn how to a build a cloud-first strategyRegister Now


Filtering dataset on date fields

Posted on 2011-10-19
Medium Priority
Last Modified: 2012-05-12
Hello Experts,

I am trying to filter a dataset with a filter by using MyDataSet.Tables("MyTable").Select("DateCol = Date")

It works fine as it is written now, but when I want to filter for a specific year or month I can't get it to work as the month() and year() functions don't seem to work when used in a filter expression.

How can I make a filter so that I can show all date fields from a specified month or year?

Thanks in advance.
Question by:Labelsoft
LVL 22

Accepted Solution

Mrunal earned 2000 total points
ID: 36998158
Better approach is:

Add one more column to datable (either from database query or before accessing for filtration.

then apply filtering on that column for matching month.

Author Comment

ID: 36998246
This sounds like an solution that I might take if there is no other way around it, but I prefer to be able to apply a filter directly on the date field, but from my searches on google I come to think that might not be possible.

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question