473,782 Members | 2,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataView filter datetime

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 time between DATE1 and DATE2".

Please some one help me.,

Thanks
-Cnu
Nov 10 '08 #1
2 12615
Cnu,

Check the documentation for the Expression property on the DataColumn
class. This is what the syntax for the RowFilter property on the DataView
class will use. Specifically, your filter will be something like:

dataView.RowFil ter = "dateTimeCo lumn >= #mm/dd/yyyy# and dateTimeColumn <
#mm/dd/yyyy#";

Some things to note. First, the format of the date should be in the
current local. So if you are using dd/mm/yyyy, then use that.

The other thing to note is that I wasn't sure if you wanted DATE2 to be
inclusive or not. If you did, and you have time values, then you are going
to have to use less than for the second operator, and your DATE2 should be
DATE2 plus one day.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Duggi" <Du************ ***@gmail.comwr ote in message
news:b1******** *************** ***********@c22 g2000prc.google groups.com...
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 time between DATE1 and DATE2".

Please some one help me.,

Thanks
-Cnu

Nov 10 '08 #2
On Nov 10, 10:33*pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Cnu,

* * Check the documentation for the Expression property on the DataColumn
class. *This is what the syntax for the RowFilter property on the DataView
class will use. *Specifically, your filter will be something like:

dataView.RowFil ter = "dateTimeCo lumn >= #mm/dd/yyyy# and dateTimeColumn <
#mm/dd/yyyy#";

* * Some things to note. *First, the format of the date should be in the
current local. *So if you are using dd/mm/yyyy, then use that.

* * The other thing to note is that I wasn't sure if you wanted DATE2to be
inclusive or not. *If you did, and you have time values, then you are going
to have to use less than for the second operator, and your DATE2 should be
DATE2 plus one day.

--
* * * * * - Nicholas Paldino [.NET/C# MVP]
* * * * * - m...@spam.guard .caspershouse.c om

"Duggi" <DuggiSrinivasa ...@gmail.comwr ote in message

news:b1******** *************** ***********@c22 g2000prc.google groups.com...
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 time between DATE1 and DATE2".
Please some one help me.,
Thanks
-Cnu- Hide quoted text -

- Show quoted text -
Thanks for the help. It worked for me. The dates are converted on
locale and then compared. I hope I do not run into issues in future.

Thanks
Cnu
Nov 11 '08 #3

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

Similar topics

1
3262
by: Jarod | last post by:
Hey I have dtMessages dataTable and there is columnt DateTime, how can I compare dates using DataView ? I need to compare hours more than dates. But the dates are also needed because sometimes 02:00 will be after 23:50 and sometimes before. So I initialize myTime = new DateTime.Now; and I need to compare it with this column, it's initialized in the same way. But it doesn't work for me when I check... : ..rowFilter = "Time <= " + time;...
3
11450
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 newly filtered data without having to create a new dataview each time. Is that possible? Also, do I need to attach the dataview to the combo box each time? if (AgencyCounties == null || sPropertyState.Text != prevPropertyState) {...
2
1500
by: vMike | last post by:
I have dataview which is stored in Cache for about 10 minutes. When a web user makes a selection the cached data is called from cache, sorted, filtered and bound to a datagrid. The cache is not re-saved. When the next user comes along if they have no querystring parameters, they are supposed to default back to the beginning of the data, but instead the data grid starts at the point the last user was viewing. The users are able to get back...
1
916
by: Mat | last post by:
I create a dataview on table. the dataview filter rows, which ID is between 1 and 10. What happens if i add a new row with ID= 5 to table after rowfilter method is called? Will this row be in my dataview automatically or i have to call rowfilter again in order that new row be in my dataview?
1
1275
by: Engineerik | last post by:
dfjhsqd asked this earlier in the week and I have the same question. How can I apply a filter to the Master table when using two datagrids in a MasterDetail relationship?
2
1233
by: Dave Prouten | last post by:
Hi all, Can anyone help me with this. I have 2 datagrids on a form, the parent datagrid has a DataView as it's DataSource. Can anyone help me with the syntex of how to create a relationship between them.
3
1413
by: Mayiko | last post by:
I am try to filter the DataGrid based on user input. I have a text box and a combo box. One contains the column and one contains the value. Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim strFilter As String Dim FilterFor As String strFilter = cmbSearchBy.Text FilterFor = txtSearchFor.Text InfoBindingSource.Filter =...
2
3180
by: Duggi | last post by:
Hi I have a dataview. I would like to apply a filter on the dataview on a column with datatype system.string. I have filter with wild char *. I need to support wild chars * and ? in the filter expression
2
3508
by: yassha | last post by:
i'm new in using vb.net, i'm using vb 2005 express and ms access for a school project. say i have a combobox that contains year say 2007, 2008 etc now i want to display rows using a year from the combobox as a criteria i tried using dataview.filter using LIKE query but it only works for text fields but not with dates. dv.RowFilter = "DateOrdered LIKE '%"+ combobox.Text + "%'" i also tried using the select query using the query designer...
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
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 we have to send another system

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.