Home All Groups Group Topic Archive Search About

ADO.NET Rowfilter - between 2 dates

Author
21 Nov 2006 9:18 AM
steffen.trommer
Dear VB experts,

how can i set a rowfilter to a Dataview that filters the data from a
startdate to a enddate?

I tried this, but whithout success:

Me.CurDataViewStatistik.RowFilter = "DATEFIELD >= #" &
Format(Me.dtpVon.Value, "yyyy\/MM\/dd") & "# AND DATEFIELD <= #" &
Format(Me.dtpBis.Value, "yyyy\/MM\/dd") & "#"

The execution shows no errors, but the rowcount is 0.

Database is Access 2003 with .NET 2.0.

Thank you
Steffen

Author
1 Dec 2006 3:44 AM
Prester John
The following works fine for me:

    mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #11/01/2006# AND
EMP_HireDate < #11/30/2006#"
As does:

   Dim d1 As Date = #11/1/2006#

   Dim d2 As Date = #11/30/2006#

   mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #" & d1.Date.ToString &
"# AND EMP_HireDate < #" & d2.Date.ToString & "#"

HTH



<steffen.trom***@gmail.com> wrote in message
Show quoteHide quote
news:1164100695.233477.188990@j44g2000cwa.googlegroups.com...
> Dear VB experts,
>
> how can i set a rowfilter to a Dataview that filters the data from a
> startdate to a enddate?
>
> I tried this, but whithout success:
>
> Me.CurDataViewStatistik.RowFilter = "DATEFIELD >= #" &
> Format(Me.dtpVon.Value, "yyyy\/MM\/dd") & "# AND DATEFIELD <= #" &
> Format(Me.dtpBis.Value, "yyyy\/MM\/dd") & "#"
>
> The execution shows no errors, but the rowcount is 0.
>
> Database is Access 2003 with .NET 2.0.
>
> Thank you
> Steffen
>
Author
1 Dec 2006 10:33 PM
Thunder
John is correct.
I would further qualify your statement by including times as well.

StartDate = '11/01/2006 00:00:00'
EndDate = '11/30/2006 59:59:99'

If you don't then, depending on the type of DateTime construct, you may miss
some records.

T.

Show quoteHide quote
"Prester John" <presterj***@comcast.net> wrote in message
news:l-OdnRS_VvB0OfLYnZ2dnUVZ_tWdnZ2d@comcast.com...
> The following works fine for me:
>
>    mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #11/01/2006# AND
> EMP_HireDate < #11/30/2006#"
> As does:
>
>   Dim d1 As Date = #11/1/2006#
>
>   Dim d2 As Date = #11/30/2006#
>
>   mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #" & d1.Date.ToString &
> "# AND EMP_HireDate < #" & d2.Date.ToString & "#"
>
> HTH
>
>
>
> <steffen.trom***@gmail.com> wrote in message
> news:1164100695.233477.188990@j44g2000cwa.googlegroups.com...
>> Dear VB experts,
>>
>> how can i set a rowfilter to a Dataview that filters the data from a
>> startdate to a enddate?
>>
>> I tried this, but whithout success:
>>
>> Me.CurDataViewStatistik.RowFilter = "DATEFIELD >= #" &
>> Format(Me.dtpVon.Value, "yyyy\/MM\/dd") & "# AND DATEFIELD <= #" &
>> Format(Me.dtpBis.Value, "yyyy\/MM\/dd") & "#"
>>
>> The execution shows no errors, but the rowcount is 0.
>>
>> Database is Access 2003 with .NET 2.0.
>>
>> Thank you
>> Steffen
>>
>
>
Author
1 Dec 2006 11:00 PM
RobinS
Although he might want to use
EndDate = '11/30/2006 23:59:59" instead of 59:59:99.

Robin
--------------------------------------
Show quoteHide quote
"Thunder" <jo***@atlanticrdc.com> wrote in message
news:O4LIliZFHHA.5104@TK2MSFTNGP03.phx.gbl...
> John is correct.
> I would further qualify your statement by including times as well.
>
> StartDate = '11/01/2006 00:00:00'
> EndDate = '11/30/2006 59:59:99'
>
> If you don't then, depending on the type of DateTime construct, you may
> miss some records.
>
> T.
>
> "Prester John" <presterj***@comcast.net> wrote in message
> news:l-OdnRS_VvB0OfLYnZ2dnUVZ_tWdnZ2d@comcast.com...
>> The following works fine for me:
>>
>>    mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #11/01/2006# AND
>> EMP_HireDate < #11/30/2006#"
>> As does:
>>
>>   Dim d1 As Date = #11/1/2006#
>>
>>   Dim d2 As Date = #11/30/2006#
>>
>>   mEmployeeAO.MainView.RowFilter = "EMP_Hiredate > #" & d1.Date.ToString
>> & "# AND EMP_HireDate < #" & d2.Date.ToString & "#"
>>
>> HTH
>>
>>
>>
>> <steffen.trom***@gmail.com> wrote in message
>> news:1164100695.233477.188990@j44g2000cwa.googlegroups.com...
>>> Dear VB experts,
>>>
>>> how can i set a rowfilter to a Dataview that filters the data from a
>>> startdate to a enddate?
>>>
>>> I tried this, but whithout success:
>>>
>>> Me.CurDataViewStatistik.RowFilter = "DATEFIELD >= #" &
>>> Format(Me.dtpVon.Value, "yyyy\/MM\/dd") & "# AND DATEFIELD <= #" &
>>> Format(Me.dtpBis.Value, "yyyy\/MM\/dd") & "#"
>>>
>>> The execution shows no errors, but the rowcount is 0.
>>>
>>> Database is Access 2003 with .NET 2.0.
>>>
>>> Thank you
>>> Steffen
>>>
>>
>>
>
>