Solved

Missing operand before 'Between' operator.

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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