System.DateTime and System.Double in VB.NET

I get error "Cannot perform '>' operation on System.DateTime and System.Double" when applying a filter on DataView.
  • 2263

When you apply:

 DataView1.RowFilter = "DateColumnName > " & DateValue

you get this error:

Cannot perform '>' operation on System.DateTime and System.Double

To use Date value in a filter, you must use pound "#" symbol around the date value like following:

dsView.RowFilter = "DateColumnName >= #" & DateTime.Today() & "#"

NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (http://www.c-sharpcorner.com/).

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.