PC Review


Reply
Thread Tools Rate Thread

Dataview row filter on date filed

 
 
vicky
Guest
Posts: n/a
 
      20th May 2004
i am filtering a dataview using rofilter, the field i am
filtering is datetime type but i only want to filter on
date part of the field ignoring time part. How is it
possible

Thanks
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      20th May 2004
Hi Vicky,

I think that the only thing I can help you with is something like this.
\\\
Dim dr2() As DataRow
For Each dr As DataRow In dt.Rows
Dim a As Integer
If CDate(dr("Dates")).Month = 5 Then
a += 1
ReDim dr2(a)
dr2(a - 1) = dr
End If
Next
MessageBox.Show(dr2(0)("Dates").ToString)
////

Cor


 
Reply With Quote
 
Rajesh Patel
Guest
Posts: n/a
 
      20th May 2004
I am not with vs.net right now. But, you can try to use <dt> >= <dt1> and
<dt> <= <dt2> for instance.

Regards,

Rajesh Patel


"vicky" <(E-Mail Removed)> wrote in message
news:f87f01c43e32$359d1370$(E-Mail Removed)...
> i am filtering a dataview using rofilter, the field i am
> filtering is datetime type but i only want to filter on
> date part of the field ignoring time part. How is it
> possible
>
> Thanks



 
Reply With Quote
 
William Ryan eMVP
Guest
Posts: n/a
 
      20th May 2004
Hi Vicky:

The whole battle is in getting the Value you are comparing against in the
correct format. You can use DateTime myDate =
(DateTime)dataVarName.ToShortDateString(); ///or you can use .Parse or any
other mechanism you want.

Anyway, assuming the example above you'd use

myDataView.Rowfilter = "DateFieldName = #" + myDate + "#";

--

W.G. Ryan, eMVP

http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
"vicky" <(E-Mail Removed)> wrote in message
news:f87f01c43e32$359d1370$(E-Mail Removed)...
> i am filtering a dataview using rofilter, the field i am
> filtering is datetime type but i only want to filter on
> date part of the field ignoring time part. How is it
> possible
>
> Thanks



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      20th May 2004
Hi Bill,

Funny, I was reading a part of the date, instead of the date part.

Thinking, thinking and no solution, however this is easy, because the date
is always the date.

:-))

Cor


 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      21st May 2004

"William Ryan eMVP" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Vicky:
>
> The whole battle is in getting the Value you are comparing against in the
> correct format. You can use DateTime myDate =
> (DateTime)dataVarName.ToShortDateString(); ///or you can use .Parse or any
> other mechanism you want.


Just don't forget to use CultureInfo.InvariantCulture when converting date
to string :-)

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      21st May 2004
Hi Miha,

> > The whole battle is in getting the Value you are comparing against in

the
> > correct format. You can use DateTime myDate =
> > (DateTime)dataVarName.ToShortDateString(); ///or you can use .Parse or

any
> > other mechanism you want.

>
> Just don't forget to use CultureInfo.InvariantCulture when converting date
> to string :-)


That is only for people who program for world around.
I thought that in Europe we all are using dd-mm-yy or variants from that and
in the US mm-dd-yy however I am very curious what it is in the Balkan
countries including Turkey because I am not sure of that, do you know that?

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query with two Tables with date filed for Date Range Rag742 Microsoft Access Queries 1 9th Oct 2007 03:42 AM
date filed =?Utf-8?B?U0lO?= Microsoft Access 3 28th Mar 2007 08:24 PM
FIlter on filed making a calulation =?Utf-8?B?c3RlcGhlbnNvbjIy?= Microsoft Access Queries 6 28th Mar 2007 06:25 PM
HELP: DataView does NOT filter :-( werk@velp.info Microsoft C# .NET 1 20th Jan 2005 05:13 PM
format for datetime filed when specifying filter for Outlook::_Items Find function Jerry Gao Microsoft Outlook Program Addins 4 3rd Oct 2004 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:06 PM.