Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:16:00+00:00 2026-06-09T12:16:00+00:00

I have an asp.net e-commerce application in which I am adding functionality of Discount:

  • 0

I have an asp.net e-commerce application in which I am adding functionality of Discount:

if the totalPurchase amount >=200, then 5% disc,
if it is >=500, then 7%.. Like that.

Problem is the discount % should be changed dynamically via Admin login. i.e. I am not allowed to write this code in code-behind.

if(totalPurchase>=200 && totalPurchase<700)
{ // code for 5% discount }

I am trying to implement recordet to iterate through database table Discount whose fields are..

DiscID -1

DiscPer -5

DiscAmount -200 

and so on..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:16:01+00:00Added an answer on June 9, 2026 at 12:16 pm

    I feel that you are missing a database column for storing your discount amount range like 200 to 700 etc. I am assuming the database table name to be Discounts and the range columns to be AmountFrom and AmountTo. Here is my solution for you:

    OleDbConnection connect = new OleDbConnection();
    connect.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Data.accdb;Persist Security Info=False;";
    connect.Open();
    
    OleDbCommand command = new OleDbCommand();
    command.CommandText = "SELECT AmountFrom, AmountTo, DiscPer FROM Discounts";
    command.Connection = connect;
    
    OleDbReader reader = command.ExecuteReader();
    
    while(reader.Read())
    {   
        int from = int.Parse(reader['AmountFrom'].toString());
        int to = int.Parse(reader['AmountTo'].toString());
        int discount = int.Parse(reader['DiscPer'].toString());
    
        if(totalPurchase >= from && totalPurchase < to) {
            MessageBox.Show("You got a discount of " + discount + "%");
        }
    }
    connect.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have asp.net application. and I have created mobile version of it which is
We have ASP.NET MVC 3 application which is integrated with Google Checkout API .
I have ASP.NET application which allows users to download a file when he/she enters
I have been working on asp.net mvc3 e-commerce application based on NopCommerce. Recently we
I have an asp.net mvc e-commerce application that requires voucher payment. how to pass
I have an ASP.net MVC 3 application running on IIS7. It is an e-commerce
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have asp.net mvc 2 application. Now I'm reimplementing it for working with Ninject
I have ASP.NET project which do some file access and manipulation, the methods which
I have an ASP.Net website which uses a MySQL database for the back end.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.