ADO.NET Rowfilter - between 2 dates

  • Thread starter Thread starter steffen.trommer
  • Start date Start date
S

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
 
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
 
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.
 
Although he might want to use
EndDate = '11/30/2006 23:59:59" instead of 59:59:99.

Robin
--------------------------------------
 
Back
Top