Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Missing operand before 'Between' operator.

Posted on 2012-12-28
5
Medium Priority
?
418 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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

722 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