ASP.NET
  Home arrow ASP.NET arrow Building a Simple Storefront with LINQ
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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: 4 stars4 stars4 stars4 stars4 stars / 3
    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


    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...
       · Not sure if I'm missing something obvious. I can't seem t find the link for the part...
       · Sorry, it accidentally got put in the .NET section rather than the ASP.NET section....
     

    ASP.NET ARTICLES

    - Adding Content to a Static ASP.NET Website
    - Building a Static ASP.NET Website in a Basic...
    - Develop Your First ASP.NET Website with Visu...
    - Run ASP.NET in Windows XP Home with Cassini ...
    - How to Test a Web Application
    - How to Add Code and Validation Controls to a...
    - Working in Source and Split Views to Build a...
    - How to Build a Web Form for a One-Page Web A...
    - How to Develop a One-Page Web Application
    - An ASP.NET Web Application in Action
    - Developing ASP.NET Web Applications
    - An Introduction to ASP.NET Web Programming
    - Introduction to the ADO.NET Entity Framework...
    - Completing an In-Text Advertising System und...
    - Programming an In-Text Advertising System un...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek