473,473 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to filter by Month using Dataview.RowFilter

Hello,

My Code:

dvM1.RowFilter = "DATEPART(Month, Datum) = " + Monat.Month + " AND
DATEPART(Year, Datum) = " + Monat.Year;

But DATEPART is not a ADO Functions?

Can someone help me?
Jun 8 '06 #1
1 9961
Dr_Franz,

No, it isn't. If you want to filter on these things then you have to
have separate columns which you want to perform the filter on. In this
case, it would be a column that has the year, and a column that has the
month.

Now, what you could do is actually have a column with the date format in
a string like so:

yyyyMMddhhmmss

And then you could use string comparisons in your filter. So if you
wanted something for one particular month, you could do:

"column like '" + Monat.Year + Monat.Month + "*'"

This way, anything in that month would be selected.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dr_Franz" <Dr*****@discussions.microsoft.com> wrote in message
news:E0**********************************@microsof t.com...
Hello,

My Code:

dvM1.RowFilter = "DATEPART(Month, Datum) = " + Monat.Month + " AND
DATEPART(Year, Datum) = " + Monat.Year;

But DATEPART is not a ADO Functions?

Can someone help me?

Jun 8 '06 #2

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...
2
by: David | last post by:
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...
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...
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
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
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.