HighTechTalks DotNet Forums  

Date filter on a DataGridView

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Date filter on a DataGridView in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Erez Mor
 
Posts: n/a

Default Date filter on a DataGridView - 02-14-2006 , 01:16 PM






hello all
i'm using vb2005.
in one of the forms i'm using the filter method of the bindingsource
i've used it before, but not on a date field.
now, any comparison i try produces an error (things like):
If tpToDate.Checked Then
strFilter = "[chqCashDate]<=" & dtDate.Value
ElseIf tpOnDate.Checked Then
strFilter = "[chqCashDate]=" & dtDate.Value

in this example, dtDate is a datetimepicker, tpToDate is a radio button, and
chqCashDate is a smalldatetime field in a sql db table

the error says something about invalid use of "=" operator.
can someone please guide me in the right way?

thanx in advance
Erez.

Reply With Quote
  #2  
Old   
Miha Markic [MVP C#]
 
Posts: n/a

Default Re: Date filter on a DataGridView - 02-22-2006 , 06:55 AM






Hi,

You might take a look at DataColumn.Expression .net help topic on how to
deal with date formats.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Erez Mor" <ErezMor (AT) discussions (DOT) microsoft.com> wrote

Quote:
hello all
i'm using vb2005.
in one of the forms i'm using the filter method of the bindingsource
i've used it before, but not on a date field.
now, any comparison i try produces an error (things like):
If tpToDate.Checked Then
strFilter = "[chqCashDate]<=" & dtDate.Value
ElseIf tpOnDate.Checked Then
strFilter = "[chqCashDate]=" & dtDate.Value

in this example, dtDate is a datetimepicker, tpToDate is a radio button,
and
chqCashDate is a smalldatetime field in a sql db table

the error says something about invalid use of "=" operator.
can someone please guide me in the right way?

thanx in advance
Erez.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.