Using the SqlDataSource Control

And then, of course, there are databases — relational or otherwise. Be it Microsoft’s SQL Server, MySQL, Oracle, PostgreSQL, Firebird, DB/2, Access, or something else, databases are the most common way to store data for our web applications, and you’ll spend the next few chapters looking at how to interact with databases successfully and efficiently.

The AdventureWorksLT Database

In this book, you’ll use the sample AdventureWorksLT database running on SQL Server for all the examples. You can download it from the Releases page on You’ll need to download and run AdventureWorksLT.msi if you’re running a 32-bit version of SQL Server or AdventureWorksLT_x64.msi if you’re running a 64-bit version. You’ll also need to make sure you’re downloading the sample for the correct version of SQL Server—2005 or 2008. Click the correct version in the Releases box on the right side of the page to make that selection.

Once you have downloaded and installed the database, you’ll need to attach it to your copy of SQL Server. If you’re using SQL Server Express, simply copy the AdventureWorksLT_data.mdf you installed to your App_Data directory and SQL Server Express will do the rest.

If you’re using SQL Server Standard, Developer, or Enterprise, you’ll need to attach it to the database engine. Open SQL Server Management Studio (SSMS) and connect to the server on which you just installed the database. Right-click the Databases node in ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.