Home All Groups Group Topic Archive Search About

Using DataView.RowFilter with DateTimes including both date and time data

Author
29 Jun 2006 7:44 PM
pnschofield
I've been scouring the Interwebs all day and can't find any
documentation on this.  I have a DataTable with two DateTime columns
returned from an Oracle database.  What I need to do is use a DataView
to filter the rows based on each of the DateTime columns matching two
DateTime values that I provide.  There's plenty of documentation on
doing this with simple dates, but what if I need rows that match a
particular date AND time, for example 6/29/2006 14:41:00?  People have
asked this question on newsgroups and people post example code that
doesn't work because they apparently haven't actually tested it.

If you've done this successfully, I would really appreciate some sample
code showing how it's done.

Thank you in advance!
Paul

Author
30 Jun 2006 6:29 AM
Cor Ligthert [MVP]
Paul,

The mostly not known fact in this is that the DateTime in the
select/rowfilter is completely based on the literals and than even in USA
style which is very confusing outside that. I see you are from that (but for
others reading this message). Therefore your date has to be something as
#6/29/2006 14:41:00# (I hope that I write it right because I make forever
mistakes in that USA styles of datetimes)

I hope this helps,

Cor

<pnschofi***@yahoo.com> schreef in bericht
Show quote
news:1151610247.263846.195040@j72g2000cwa.googlegroups.com...
> I've been scouring the Interwebs all day and can't find any
> documentation on this.  I have a DataTable with two DateTime columns
> returned from an Oracle database.  What I need to do is use a DataView
> to filter the rows based on each of the DateTime columns matching two
> DateTime values that I provide.  There's plenty of documentation on
> doing this with simple dates, but what if I need rows that match a
> particular date AND time, for example 6/29/2006 14:41:00?  People have
> asked this question on newsgroups and people post example code that
> doesn't work because they apparently haven't actually tested it.
>
> If you've done this successfully, I would really appreciate some sample
> code showing how it's done.
>
> Thank you in advance!
> Paul
>

AddThis Social Bookmark Button