Solved

Missing operand before 'Between' operator.

Posted on 2012-12-28
5
399 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

912 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

22 Experts available now in Live!

Get 1:1 Help Now