Great community. Great ideas.

Welcome to ASP/Free, a community dedicated to helping beginners and professionals alike in improving their knowledge of Microsoft's development and administration technologies. Sign up today to gain access to the combined insight of tens of thousands of members.

Thread: Promo Code

Results 1 to 2 of 2
Share This Thread →
  1. #1
    captain15 is offline Registered User
    Join Date
    Jul 2012
    Rep Power

    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?



  2. #2
    rclark's Avatar
    rclark is offline I do .NET for a living
    Join Date
    Sep 2003
    Rep Power
    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)

Share This Thread →

Become Part of This Conversation

Join NowFor Free!

Similar Threads

  1. Promo Code
    By captain15 in forum ASP Development
    Replies: 12
    Last Post: November 16th, 2012, 01: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, 06:37 PM
  3. Promo Dates and Other - If Statements
    By badmp3 in forum ASP Development
    Replies: 1
    Last Post: December 20th, 2009, 06:04 AM
  4. Automated query for multiple promo codes
    By kabucek in forum Microsoft SQL Server
    Replies: 1
    Last Post: May 9th, 2009, 08:52 PM
  5. Macy's plans its biggest promo (
    By RSS_News_User in forum Business News
    Replies: 0
    Last Post: November 23rd, 2005, 06:05 AM

ASP Free Advertisers and Affiliates