473,383 Members | 1,864 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,383 software developers and data experts.

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 12583
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.RowFilter = "dateTimeColumn >= #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.com

"Duggi" <Du***************@gmail.comwrote in message
news:b1**********************************@c22g2000 prc.googlegroups.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.guard.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.RowFilter = "dateTimeColumn >= #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.com

"Duggi" <DuggiSrinivasa...@gmail.comwrote in message

news:b1**********************************@c22g2000 prc.googlegroups.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
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...
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: 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...
1
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...
1
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
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...
3
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...
2
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...
2
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.