Solved

Missing operand before 'Between' operator.

Posted on 2012-12-28
5
394 Views
Last Modified: 2013-01-18
I get the error "Missing operand before 'Between' operator." om

dvholidays = New DataView(dtholidays, "between '01/ " & e.Day.Date.Year & "/" & e.Day.Date.Month & " 'AND '" & "31/ " & e.Day.Date.Year & "/" & e.Day.Date.Month & "'", "", DataViewRowState.CurrentRows)
0
Comment
Question by:runnerjp2005
  • 3
5 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38726751
This would not work because you are applying a Between to strings not dates.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38726752
Try using CDate function around date string.
0
 

Author Comment

by:runnerjp2005
ID: 38726790
cdate seems to throw this error: BC30516: Overload resolution failed because no accessible 'New' accepts this number of arguments.


dvholidays = New DataView(dtholidays, "Date between"' & CDate("01/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & '" AND "' & CDate("28/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & "'", "", DataViewRowState.CurrentRows)
Line 86:
Line 87:
0
 
LVL 35

Expert Comment

by:YZlat
ID: 38726830
try something like this:

dvholidays = New DataView(dtholidays)
dvholidays.RowFilter="Date BETWEEN '" & CDate("01/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & "' AND '" & CDate("28/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & "'"

Open in new window


or

dvholidays = New DataView(dtholidays)
dvholidays.RowFilter="Date BETWEEN '" & DateTime.Parse("01/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & "' AND '" & DateTime.Parse("28/" & e.Day.Date.Month & "/" & e.Day.Date.Year) & "'"

Open in new window

0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 38727047
Try

dvholidays = New DataView(dtholidays)
dvholidays.RowFilter="Date BETWEEN CDate('01/" & e.Day.Date.Month & "/" & e.Day.Date.Year"')  AND CDate('"28/" & e.Day.Date.Month & "/" & e.Day.Date.Year & "')"

Open in new window

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now