0
votes

I'm trying to filter a dataview using a DataView RowFilter. I want to filter out data based on two date values checked on one column:

Dim dtFuture As Date = DateAdd(DateInterval.Month, 6, Today)
dv.RowFilter = "ValidUntil >" & dtFuture.ToString & "AND ValidUntil > " & Today.ToString

I am getting the error Syntax error: Missing operand after '00' operator.. Not sure whether I am doing it the right way.

3
Syntax error: Missing operand after '00' operator. - Joshua

3 Answers

5
votes

I think you need to wrap the dtFuture values in single quotes :

Dim dtFuture As Date = DateAdd(DateInterval.Month, 6, Today)
dv.RowFilter = "ValidUntil >'" & dtFuture.ToString() & "' AND ValidUntil > '" & Today.ToString() & "'"

ToString should also have brackets, and you need a space before the AND.

1
votes

Right off the bat the ToString method should have parenthesis eg; dtFuture.ToString()

Hope this helps!

0
votes

Try formatting the dtFuture as SQL Date instead of using culture dependant ToString (use "#mm/dd/yyyy#" format)