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

Filtering a dataview

Hi all,

I'm trying to filter a dataview down to a 24-hour period.

I tried just rowfilter='mydate' (mydate being something like 03/26/2005) and
it came up with nothing (due to the stupid time stamp).

I'm tried rowfilter>'03/25/2005' AND <'03/27/2005' and ended up with every
entry after midnight on the 25'th.

so now I'm trying >='03/26/2005' AND <'03/27/2005' and am getting every
entry from 03/2/2005

I'm going CrAzY! Can anyone save my sanity here!?

Usarian Skiff
Nov 21 '05 #1
3 1060
By 24 hours do you mean the last 24 hours or just today?

How about something like
dv.RowFilter = "tabledate => " & Now.AddHours(-24) & " AND tabledate <= " &
Now()
Eric Dreksler
"Usarian Skiff" <us***********@servicecentermetals.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to filter a dataview down to a 24-hour period.

I tried just rowfilter='mydate' (mydate being something like 03/26/2005)
and
it came up with nothing (due to the stupid time stamp).

I'm tried rowfilter>'03/25/2005' AND <'03/27/2005' and ended up with every
entry after midnight on the 25'th.

so now I'm trying >='03/26/2005' AND <'03/27/2005' and am getting every
entry from 03/2/2005

I'm going CrAzY! Can anyone save my sanity here!?

Usarian Skiff

Nov 21 '05 #2
Usarian,
I normally use # to delimit the dates, have you tried something like:

Dim view As New DataView(table)
view.RowFilter = "date1 >= #2/17/2005# and date1 < #2/18/2005#"
For Each row As DataRowView In view
Debug.WriteLine(row!date1)
Next

Given a table such as:
Dim table As New DataTable
table.Columns.Add("date1", GetType(DateTime))

table.Rows.Add(New Object() {#2/16/2005 9:00:00 AM#})
table.Rows.Add(New Object() {#2/16/2005 12:00:00 PM#})
table.Rows.Add(New Object() {#2/16/2005 7:00:00 PM#})
table.Rows.Add(New Object() {#2/16/2005 1:00:00 PM#})

table.Rows.Add(New Object() {#2/17/2005 9:00:00 AM#})
table.Rows.Add(New Object() {#2/17/2005 12:00:00 PM#})
table.Rows.Add(New Object() {#2/17/2005 7:00:00 PM#})
table.Rows.Add(New Object() {#2/17/2005 1:00:00 PM#})

table.Rows.Add(New Object() {#2/18/2005 9:00:00 AM#})
table.Rows.Add(New Object() {#2/18/2005 12:00:00 PM#})
table.Rows.Add(New Object() {#2/18/2005 7:00:00 PM#})
table.Rows.Add(New Object() {#2/18/2005 1:00:00 PM#})

Hope this helps
Jay

"Usarian Skiff" <us***********@servicecentermetals.com> wrote in message
news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to filter a dataview down to a 24-hour period.

I tried just rowfilter='mydate' (mydate being something like 03/26/2005)
and
it came up with nothing (due to the stupid time stamp).

I'm tried rowfilter>'03/25/2005' AND <'03/27/2005' and ended up with every
entry after midnight on the 25'th.

so now I'm trying >='03/26/2005' AND <'03/27/2005' and am getting every
entry from 03/2/2005

I'm going CrAzY! Can anyone save my sanity here!?

Usarian Skiff

Nov 21 '05 #3
Usarian,

Will you please be so kind to place questions not multiposted however when
relevant crossposted
Sending 1 message to more newsgroups in a time.

Now there where 4 people giving you an answer, where you did not even tell
now that Jay's answer did fit your question in this newsgroup.

Thanks in advance.

Cor

"Usarian Skiff" <us***********@servicecentermetals.com> schreef in bericht
news:eh**************@TK2MSFTNGP09.phx.gbl...
Hi all,

I'm trying to filter a dataview down to a 24-hour period.

I tried just rowfilter='mydate' (mydate being something like 03/26/2005)
and
it came up with nothing (due to the stupid time stamp).

I'm tried rowfilter>'03/25/2005' AND <'03/27/2005' and ended up with every
entry after midnight on the 25'th.

so now I'm trying >='03/26/2005' AND <'03/27/2005' and am getting every
entry from 03/2/2005

I'm going CrAzY! Can anyone save my sanity here!?

Usarian Skiff

Nov 21 '05 #4

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: 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
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...
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
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
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...
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...

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.