'>' operation on System.DateTime and System.Double in ASP.NET using VB.NET

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

When you apply below syntax

 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

© 2018 DotNetHeaven. All rights reserved.