Thread: Promo Code

    #1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jul 2012
    Posts
    16
    Rep Power
    0

    Promo Code


    I am trying to add a promo code to my website that will allow the input of a promo code and give the client an additional 5% discount. This is the code that I have:

    Dim Promo as String, formval
    Promo = "BNOV21"
    formval = request.form("discount")

    lblTotal.Text = GetItemTotal()
    If (formval = Promo) and (session("discount") = "") Then
    GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)
    session("discount") = GetItemTotal()
    end if
    lblTotal0.Text = RetailShip
    lblTotal1.Text = RetailShip + GetItemTotal()
    Itemlbl.Text = RetailShip


    If session("discount") <> then GetItemTotal() = session("discount")

    If objDT.Rows.Count = 0 Then

    lblTotal0.Text = "0.00"
    lblTotal1.Text = "0.00"

    This is the error I get:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Compilation Error
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30068: Expression is a value and therefore cannot be the target of an assignment.

    Source Error:



    Line 412: lblTotal.Text = GetItemTotal()
    Line 413: If (formval = Promo) and (session("discount") = "") Then
    Line 414: GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)
    Line 415: session("discount") = GetItemTotal()
    Line 416: end if

    Can someone help me?

    Thanks,


    Dave
  2. #2
  3. I do .NET for a living
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,549
    Rep Power
    211
    Line 414: GetItemTotal() = GetItemTotal() - (GetItemTotal() * .05)

    GetItemTotal() appears to be a function or method. You can't assign a value to that type of object. If GetItemTotal() returns a double, then you could have something like:
    dblItemTotal = GetItemTotal() - (GetItemTotal() * .05)
    Roger (.NET MCP)

Similar Threads

  1. Promo Code
    By captain15 in forum ASP Development
    Replies: 12
    Last Post: November 16th, 2012, 02:26 PM
  2. IxWebHosting Promo Code For 25% Off Active For 2012
    By chanelc707 in forum Windows Web Hosting
    Replies: 0
    Last Post: September 4th, 2012, 07:37 PM
  3. Promo Dates and Other - If Statements
    By badmp3 in forum ASP Development
    Replies: 1
    Last Post: December 20th, 2009, 07:04 AM
  4. Automated query for multiple promo codes
    By kabucek in forum Microsoft SQL Server
    Replies: 1
    Last Post: May 9th, 2009, 09:52 PM
  5. Macy's plans its biggest promo (USATODAY.com)
    By RSS_News_User in forum Business News
    Replies: 0
    Last Post: November 23rd, 2005, 07:05 AM

IMN logo majestic logo threadwatch logo seochat tools logo