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

DataView and DateTime

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;
..rowFilter = "Time <= #" + time + "#";
..rowFilter = "Time <= '" + time + "'";

nor of this works for me, maybe you can help ?
Jarod
Nov 17 '05 #1
1 3068
Hi Jarod,

You should use this format:
..rowFilter = "Time <= #yyyy/mm/dd hh:MM#"

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

"Jarod" <Ja***@discussions.microsoft.com> wrote in message
news:F8**********************************@microsof t.com...
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;
.rowFilter = "Time <= #" + time + "#";
.rowFilter = "Time <= '" + time + "'";

nor of this works for me, maybe you can help ?
Jarod

Nov 17 '05 #2

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

Similar topics

3
by: ad | last post by:
I have a DataView, say myDV, it contain a DataTime field, "Birth". I want to get the Birth Value from the DataView: DateTiem dBirth= (DateTime)myDV; But the complier throw an error. How can...
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...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
3
by: randy1200 | last post by:
I have a DataView (dv) that includes a StartDate DateTime column. I'd like to return the DataView record that contains a StartDate value closest to my IncidentDate value: string filter =...
0
by: neeraj | last post by:
Hi, all Could anny one give me help how can I use like operator with these data types "integer , datetime or boolean" in DataView.RowFilter Actually when I try to get the data from dataview...
2
by: neeraj | last post by:
Hi, all Could anny one give me help how can I use like operator with these data types "integer , datetime or boolean" in DataView.RowFilter Actually when I try to get the data from dataview...
1
by: spartacus | last post by:
I am trying to filter a dataview with a date variable. The complete unfiltered table has 40 rows in it. If filtered as coded below it should return 8 rows, but I always get 40 rows...here is the...
0
by: webaccess | last post by:
Hi Friends ..!! I want to use datagrid/dataview control to data in tablular format,also I want to add paging and format the data of table column. Problem is data is coming from API Dom in as...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.