ASP.NET
  Home arrow ASP.NET arrow Building a Simple Storefront with LINQ
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

Building a Simple Storefront with LINQ
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-04-29

    Table of Contents:
  • Building a Simple Storefront with LINQ
  • ProductCategory Table
  • Creating the Master Page
  • Displaying Product Pictures

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Building a Simple Storefront with LINQ
    (Page 1 of 4 )

    In this article, we'll take a look at data access in ASP.NET via LINQ by building a simple storefront (browse functionality) with ASP.NET. We'll use the light version of the Adventure Works Cycles sample database to provide data, and we'll access this data through LINQ to SQL. This article is the first part of a three-part series.

    LINQ is a very promising and very powerful technology that allows various types of datasources to be queried in a unified way via the use of providers, such as LINQ to Objects, LINQ to SQL and LINQ to XML. Using LINQ in a regular Windows application is simple enough. All one has to do is drop a query straight into an assignment and then use the variable appropriately (for example, by looping over it and displaying the results). But what about web applications? How does one hook up LINQ and ASP.NET? And what features does ASP.NET provide to make LINQ usage simple?

    The Adventure Works Cycles Sample Database

    The Adventure Works Cycles sample database provides an example database with commerce data already in it. However, the full database is a bit too complex for our purposes, so we'll be using the light version of the database, which packs a smaller amount of data into only a handful of tables. This version of the sample database is better suited to explore basic concepts.

    If you don't already have the database, it's a free download.

    Download the appropriate installer for AdventureWorksLT. Then simply run the installer, which sets up the tables and inserts the data, providing everything that's needed to get started.

    Create a new empty web site and add the Adventure Works database:



    In the database explorer, you can see the tables provided:



    In this article, we'll be using the Product tables. Let's take a quick look at each of these tables, starting with the Product table:


    This table is, of course, where the basic details of each product are stored. Each product is assigned a unique ID, and each product is also assigned a ProductCategoryID and ProductModelID. The ProductCategoryID field corresponds to an entry in the ProductCategory table, and the ProductModelID field corresponds to an entry in the ProductMode table. We'll get to these tables in a moment, but take a look at the ThumbNailPhoto field. This stores a picture of the item in binary format. In order to display the image for each product, we'll need to create a page that extracts the binary representation of the picture from the database and then displays it.

    More ASP.NET Articles
    More By Peyton McCullough


       · Thanks a lot for the article. I was looking for similar example. Waiting for the...
       · Thanks for the comment, and the next article is now posted.Anyway, for everyone...
     

    ASP.NET ARTICLES

    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...
    - Completing an ASP.NET AJAX Server-Centric Ba...
    - Information Management for an ASP.NET AJAX S...
    - Comment and Order Management for an ASP.NET ...
    - Back-end Management Tasks for an ASP.NET AJA...
    - User Information Management for an ASP.NET A...
    - Adding Comments and Search to an ASP.NET AJA...
    - Order-Related Modules for an ASP.NET AJAX Se...
    - User and Role Management for an ASP.NET AJAX...
    - Programming an ASP.NET AJAX Server-Centric B...
    - Tables and Relationships for an ASP.NET AJAX...
    - Building an ASP.NET AJAX Server-Centric Base...
    - Finishing an Introductory Look at CIL
    - An Introduction to CIL

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway