Solved

Missing operand before 'Between' operator.

Posted on 2012-12-28
5
409 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 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