Hello all,
I need help regarding filtering a date column in the gridview in Visual Studio 2010. This is my code:
Me.HVseznamBindingSource.Filter = "Date = #" & Me.Datetimepicker1.Value & "#"
But, when I run this code the gridview returns 0 records.
I do not know what it could be. I have changed the date format on all fronts, table, DateTimePicker. Short, Long, custom. However, it still gives the same results, or getting code error that
#" & Me.Datetimepicker1.Value & "#"
is wrong format.
Would someone check this code or point me in the right direction on how to filter gridview by date.
Thank you in advance for your help to anyone!
[original title]
Filter gridview by datepicker??!! (Visual Studio)
Modification: (Moved from answer)
Thanks for your replies.
I have found the code:
Me.HVseznamBindingSource.Filter = "Date = '" & Me.Datetimepicker1.Value.date & "'"
It can be used for Access or Sql server...
End Modification