473,404 Members | 2,213 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,404 software developers and data experts.

Filtering a dataview

I have DataView of DataSet. I want to filter the DataView by the date.
dvEvents.RowFilter = "BegDate >= '" + dateTimePicker1.Value.Date + "'
BegDate <= '" + dateTimePicker2.Value.Date.AddDays(1) + "'";

My problem is that the filter is getting the wrong values.
dateTimePicker1.Value = 8/2/2006
dateTimePicker2.Value = 8/3/2006

You would only expect records with 8/2 or 8/3 to show up. I'm getting
all records that are 8/2 and 8/2X.

How can I prevent the records that shouldn't be showing up from showing
up?

Thanks!

Aug 2 '06 #1
2 1971
Indy,

You don't want to use a string representation. Rather, use '#' to
delimit your dates, like so:

dvEvents.RowFilter = "BegDate >= #" + dateTimePicker.Value.Date ...

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

"IndyChris" <ch***********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
>I have DataView of DataSet. I want to filter the DataView by the date.
dvEvents.RowFilter = "BegDate >= '" + dateTimePicker1.Value.Date + "'
BegDate <= '" + dateTimePicker2.Value.Date.AddDays(1) + "'";

My problem is that the filter is getting the wrong values.
dateTimePicker1.Value = 8/2/2006
dateTimePicker2.Value = 8/3/2006

You would only expect records with 8/2 or 8/3 to show up. I'm getting
all records that are 8/2 and 8/2X.

How can I prevent the records that shouldn't be showing up from showing
up?

Thanks!

Aug 2 '06 #2
Hi,

try:
dvEvents.RowFilter = "BegDate >= '" +
dateTimePicker1.Value.Date.ToShortDateString() + "'
BegDate <= '" + dateTimePicker2.Value.Date.AddDays(1)ToShortDateSt ring() +
"'";

Why you have two datetimepickers? if so the upper bound should be compared
to dateTimePicker2.Value
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"IndyChris" <ch***********@yahoo.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
>I have DataView of DataSet. I want to filter the DataView by the date.
dvEvents.RowFilter = "BegDate >= '" + dateTimePicker1.Value.Date + "'
BegDate <= '" + dateTimePicker2.Value.Date.AddDays(1) + "'";

My problem is that the filter is getting the wrong values.
dateTimePicker1.Value = 8/2/2006
dateTimePicker2.Value = 8/3/2006

You would only expect records with 8/2 or 8/3 to show up. I'm getting
all records that are 8/2 and 8/2X.

How can I prevent the records that shouldn't be showing up from showing
up?

Thanks!

Aug 2 '06 #3

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

Similar topics

3
by: Alex Ayzin | last post by:
Hi, I have a problem that might be easy to solve(possibly, I've just overlooked an easy solution). Here we go: I have a dataset with 2 datatables in it. Now, I need to do the following: if...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
1
by: Webgour | last post by:
I'm tring to filter a dataview with multiple rowfilters. The problem is that each time I use RowFilter on the DataView i'm quering the full dataview as it was loaded, not the filtered version. Is...
2
by: Marco Ippolito | last post by:
I have an offline DataSet: id (PK, sorted ASC), firstname, enabled 1, Aaron, true 2, Bill, false 3, Charlie, true .... 10001, Mike, false 10002, Nathan, false
1
by: Jason | last post by:
I've gathered a bunch of data from Active Directory and placed it into a datatable ("ADTable"). I now need to sort and filter this table based on the selection of a drop down list("ddlCategory"). ...
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records...
2
by: Jason Huang | last post by:
Hi, I use the ReadXML method in my C# Windows Form project. Here is some of my C# code: xmlDS.ReadXml(curDir + "\\Dept.xml") ; There're 20 rows and 5 columns in the Dept.xml. But now I just...
2
by: Anup Daware | last post by:
Abstract: I want to filter a dataview with a value where column name have a SPACE. Description:- I bind a dataview to a datagrid, The query which is fetching the results in Dataset is something...
3
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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,...

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.