473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

HOW to filter by Hour using DataView.RowFilter ?

Hi, I use DataView to filter my record.
But when I use:

ls_filter += " and DATEPART(hh, CA103)=" + i ;
mydv.RowFilter = ls_filter;

I got error.

How should I filter by hour using DataView.Rowfilter?

Thanks for kind advice, David.

Nov 17 '05 #1
2 2862
Hi David,

You could return the DATEPART of you datetime column as a seperate column in
your original SQL query. You could then filter by this field very easily in
your DataView's RowFilter.

e.g Instead of:

SELECT TheDateColumn FROM TheTable

do this:

SELECT TheDateColumn, DATEPART(month, TheDateColumn) AS [MonthFilterCol]
FROM TheTable

Regards,

Peter

"David" wrote:
Hi, I use DataView to filter my record.
But when I use:

ls_filter += " and DATEPART(hh, CA103)=" + i ;
mydv.RowFilter = ls_filter;

I got error.

How should I filter by hour using DataView.Rowfilter?

Thanks for kind advice, David.

Nov 17 '05 #2
Thank you for your quickly reply, Peter.

David.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: werk | last post by:
For limiting access to the database to strictly necessary I try to filter the query by using DataView. Thw DataSet ds contains three columns (fields) : (LAND_ID, Landcode, Landnaam) and four...
3
by: Vern | last post by:
The following code retrieves data into a dataset, and then creates a dataview with a filter. This dataview is then attached to a combobox. When the effective date changes, I would like to see the...
7
by: Mike | last post by:
I'm trying to filter a dataset on items that are being passed in via a querystring. the string looks like this. chevy|ford|BMW| on the information page i split the string such as...
2
by: AJ | last post by:
Hi all, An easy question! I have a datagrid that can needs to provide filter functionality. I have three controls above the grid (txtSearch,ddlSearchBy,btnSearch) btnSearch calls...
6
by: phonl | last post by:
VB.Net 2005 I have a bound datagrid with a list of names. I want to add a button that will filter the names so that only the names that start with "H" will display. How would I do that? ...
4
by: Chris Botha | last post by:
Don't know if this can be done, but if I have a DataTable/DataView that has an integer column. Is there a way to do a "LIKE '123%'" kind of a filter on the column, which obviously works for text a...
5
by: shapper | last post by:
Hello, I have a GridView and I need to display only the records which field in datasource named "visible" is set to true. How can I do this? Thanks, Miguel
2
by: Raymond Chiu | last post by:
Dear all, If I have the dataset, What the code should be to filter records in the dataset by some fields criteria? Is it like a SQL? Thanks for your help,
2
by: Duggi | last post by:
Hi I have a dataview dv, in which one of the column is a date time column. I would like to apply filter on this column. The filter should be some thing like "All the rows that has the date...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.