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

P

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
 
C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top