Date Between Help or Advice

Discussion in 'C#' started by james6380, Feb 19, 2008.

  1. #1
    Step1.asp send date to Step2.asp which is below

    Day= 1
    Month= 1
    Year= 2008

    ' -- GRAB CODE FEATURE --
    
    strDay = Request.Form("Day")
    strMonth = Request.Form("Month")
    strYear = Request.Form("Year")
    AdultNo = Request.Form("AdultNo")
    ChildNo = Request.Form("ChildNo")
    NoNights = Request.Form("NoNights")
    
    
    ' -- Grab Price Based on Month --
    
    Select Case strDay strMonth strYear
    
    ' -- Low Season from Jan - April --
    	Case cDate("01/01/2008") > cDate("30/04/2008")  
    		AdultPrice = 25.00
    		ChildPrice = 11.00
    
    ' -- High Season from May - Aug --
    	Case cDate("01/05/2008") > cDate("30/06/2008")  
    		AdultPrice = 31.50
    		ChildPrice = 12.50
    
    End Select
    
    ' -- Calculate Prices --
    
    intAdultTotal = CDbl(AdultPrice) * (AdultNo)
    intChildTotal = CDbl(ChildPrice) * (ChildNo)
    intTotal = CDbl((intAdultTotal + intChildTotal) * NoNights)
    Code (markup):
    But when I run this i get

    Microsoft VBScript compilation error '800a03ea'

    Syntax error

    /booking/step2.asp, line 54

    Case cDate("01/01/2008") > cDate("30/04/2008")


    HELP PLEASE
     
    james6380, Feb 19, 2008 IP
  2. HomeStart

    HomeStart Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    CASE statement is to identify whether a variable matches a specific value, NOT whether it meets a condition.

    You need to use an IF/THEN statement for this...

    ' -- Grab Price Based on Month --

    REMOVE--> Select Case strDay strMonth strYear

    ' -- Low Season from Jan - April --
    If strMonth >= 1 AND strMonth <= 4 Then
    AdultPrice = 25.00
    ChildPrice = 11.00
    End If

    ' -- High Season from May - Aug --
    If strMonth >= 5 AND strMonth <= 8 Then
    AdultPrice = 31.50
    ChildPrice = 12.50
    End If

    REMOVE--> End Select
     
    HomeStart, Feb 20, 2008 IP