8.1. Building a LINQ to SQL CRUD Page

The high priests of geekdom usually frown on RAD and its associated design tools. Perhaps they invoice clients by the hour, enjoy typing, and have no reason to get home on time. For the rest of us, though, it makes sense to use the best tools to build a very useful, data-driven page, like I show you how to do here.

NOTE

This chapter requires using the Microsoft Northwind database with SQL Server or SQL Server Express. Chapter 6 includes details on where you can download the Northwind files and how to connect via Visual Web Developer.

8.1.1. Creating the database access code

Although creating the database access code suggests that you're going to create code, the meaning is akin to a worker who steers the paving machine "paves" the Alsace road. The tool does the hard work while you admire your efforts. Follow these steps to use the object relational designer to generate the database access code that you use throughout this chapter:

  1. Add the Northwind database to your project (see Chapter 6).

  2. Add a LINQ to SQL Classes file called NWDataClasses.dbml to your project (FileNew FileLINQ to SQL ClassesAdd).

    If you see a prompt to put the file in the App_Code ...

Get ASP.NET 3.5 For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.