Click here to Skip to main content
Licence 
First Posted 20 Apr 2004
Views 294,103
Downloads 12,092
Bookmarked 140 times

Shopping Cart using C#.NET, Web Forms and SQL Server

By Shruti Shrivastava | 20 Apr 2004
Shopping cart using C#.NET, Web Forms and SQL Server.
11 votes, 20.8%
1
2 votes, 3.8%
2
3 votes, 5.7%
3
14 votes, 26.4%
4
23 votes, 43.4%
5
3.61/5 - 53 votes
μ 3.63, σa 2.75 [?]

Introduction

This application is a Shopping Cart where users can select items and place an order. I have added the features of login, and adding new users if user does not exist. Validations are performed wherever needed like email format validation, zipcode etc.

Fig. 1

Database: For the purpose, I have used the NorthWind database and SQL Server.

The two main tables used are:

  1. Products table
  2. Order Details table.

I have used two classes:

public class CartRow
{
    public string id;
    public string name;
    public string price;
    public string items;
};
public class Cart
{
    public System.Collections.ArrayList list = new ArrayList(20);
};

The two main web-forms are Main.aspx and CheckOut.aspx. Main.aspx contains a grid showing all items present in the products table along with the price per unit and the quantity per unit. Fig 1 shows the Main.aspx page, where user can select items from the products grid (left). As he selects an item, it is added to his cart and the item is displayed in the right panel. The total price is displayed in the label above. As the user adds more items to his cart, the recalculated price is shown. Upon clicking the clear cart button, the cart gets empty.

If the user now wants to finalize the order and presses the CheckOut button, he is redirected to the Login.aspx page (Fig 2). I have set the default username as “user” for the sample and password is “u”.

Fig 2.

And finally, the user is asked to enter the Credit Card number, billing PIN code and his email address. It does the client side validations and then confirms the order placed by sending a mail to the user as shown in (Fig 3).

And the order is finalized. For more advanced shopping cart, this information plus the item information has to be stored in some database.

Fig 3

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Shruti Shrivastava

Web Developer

United States United States

Member
I have done Master’s in Computer Science. Also I am Microsoft Certified Application Developer (MCAD .NET). I am working with Visual C# .NET since two years. Currently I am looking for a job as C# Developer. You can reach me at shru27@hotmail.com.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Questiondatabase Pinmembervinay chauhan42019:44 4 Feb '12  
Questiondatabase Pinmembervarsti2:46 30 Jan '12  
Questionhi Pinmembersaranyajana22:43 22 Jan '12  
Questiondatabase Pinmembermoeym22:50 9 Jan '12  
QuestionDAtabase attachment Pinmembermeestersumit4:07 26 Dec '11  
GeneralMy vote of 5 Pinmembermeestersumit4:06 26 Dec '11  
QuestionDatabase Pinmemberpayam10005:52 25 Dec '11  
QuestionDatabase Pinmemberpayam10005:32 25 Dec '11  
GeneralRequest for database PinmemberMember 84865970:51 14 Dec '11  
Questionhi Pinmembershirin_k1921:33 7 Dec '11  
Questionshopping cart Pinmemberkanika bhagat3:55 7 Dec '11  
QuestionRequest for Database PinmemberAlifawad40922:57 2 Dec '11  
Questionrequest for database Pinmembermage1611:22 28 Nov '11  
QuestionRequest for database Pinmemberfacelesslucifer22:14 19 Nov '11  
Questiondatabase Pinmembersarita khotani7:42 12 Nov '11  
Generaldatabase PinmemberMember 39994769:38 8 Nov '11  
QuestionDatabase PinmemberDinesh Balendran22:06 25 Sep '11  
Questioneshopping PinmemberMember 81677365:07 17 Aug '11  
QuestionPlease send Database Details which you used to create Shopping cart Pinmemberguru4IAS1:39 30 Jun '11  
GeneralDo you have a simple shopping cart in ASP.net using VB code Pinmemberaradhakrishnan14:38 4 Feb '11  
Generalrequesting to send database PinmemberLakshmisaraswathi21:23 18 Jan '11  
GeneralRe: requesting to send database PinmemberDarshanGowda00920:52 17 Aug '11  
Generalpls send me database Pinmemberhellovatsu6:04 1 Dec '10  
GeneralRe: pls send me database PinmemberDGamer10:17 2 Dec '10  
QuestionIs anyone here? PinmemberDGamer17:59 26 Nov '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 21 Apr 2004
Article Copyright 2004 by Shruti Shrivastava
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid