R
ronchese
Hi.
I'm trying to make a criteria string to use in Select() method of a datatable, searching for a date, but it is apparently not working!
In one of my tests, I have a datatable with 1 row and a field containing the following value (extracted from Immediate Window):
?dtbSample.Rows(0).Item("COM_STARTDATE")
#5/8/2006 9:00:00 AM# {Date}
Date: #5/8/2006 9:00:00 AM#
(for better understand, consider this date as '2006/05/08')
Then, I test a criterium to DON'T show that row, using this:
arrRows = dtbSample.Select("COM_STARTDATE >= '2006/05/09'")
Now, look the results in immediate window:
?arrRows.Length
1
!!!!!!
The Select() is returning a DataRow with a date less than the specified criterium, which is requiring a date higher than existing in the DataTable!!
In resume, '2006/05/08' is less than "COM_STARTDATE >= '2006/05/09'", but is returning like if '2006/05/08' is higher.
Someone already noticed that behaviour? There is a way to fix it?
Cesar
ps.:
For you know, I tryied to build criteria like below and still is returning row (not working):
("COM_STARTDATE >= #'2006/05/09#") 'yyyy/MM/dd and #
("COM_STARTDATE >= '05/09/2006'") 'MM/dd/yyyy
("COM_STARTDATE >= '" & TheDate.ToString & "'") 'a Date datatype
("COM_STARTDATE >= #05/09/2006#") 'MM/dd/yyyy and #
("COM_STARTDATE >= #May/09/2006#") 'MMM/dd/yyyy and #
I repeat, these don't works!! They are returning the row. :^P
I'm trying to make a criteria string to use in Select() method of a datatable, searching for a date, but it is apparently not working!
In one of my tests, I have a datatable with 1 row and a field containing the following value (extracted from Immediate Window):
?dtbSample.Rows(0).Item("COM_STARTDATE")
#5/8/2006 9:00:00 AM# {Date}
Date: #5/8/2006 9:00:00 AM#
(for better understand, consider this date as '2006/05/08')
Then, I test a criterium to DON'T show that row, using this:
arrRows = dtbSample.Select("COM_STARTDATE >= '2006/05/09'")
Now, look the results in immediate window:
?arrRows.Length
1
!!!!!!
The Select() is returning a DataRow with a date less than the specified criterium, which is requiring a date higher than existing in the DataTable!!
In resume, '2006/05/08' is less than "COM_STARTDATE >= '2006/05/09'", but is returning like if '2006/05/08' is higher.
Someone already noticed that behaviour? There is a way to fix it?
Cesar
ps.:
For you know, I tryied to build criteria like below and still is returning row (not working):
("COM_STARTDATE >= #'2006/05/09#") 'yyyy/MM/dd and #
("COM_STARTDATE >= '05/09/2006'") 'MM/dd/yyyy
("COM_STARTDATE >= '" & TheDate.ToString & "'") 'a Date datatype
("COM_STARTDATE >= #05/09/2006#") 'MM/dd/yyyy and #
("COM_STARTDATE >= #May/09/2006#") 'MMM/dd/yyyy and #
I repeat, these don't works!! They are returning the row. :^P