Scott on Writing

Musings on technical writing...

Working with Data in ASP.NET 2.0

About once a week I get an email from a reader of ASP.NET Data Web Controls Kick Start wondering if I'm going to be updating the book for ASP.NET 2.0. (For those unfamiliar with the book, Data Web Controls Kick Start is a 350+ page book focusing entirely on working with the DataGrid, DataList, and Repeater controls in ASP.NET 1.x; the An Extensive Examination of the DataGrid Web Control article series was the impetus for the book.)

My answer to them is, “Yes, I'm writing an update to this book, but one that's entirely online.” In particular, I've been working on a series of “Working with Data in ASP.NET 2.0” tutorials for Microsoft and am proud to announce that the first 10 of these tutorials are now available online!

The “Working with Data in ASP.NET 2.0” tutorials are modeled after the tutorial series started by Scott Guthrie and aim to provide step-by-step instructions (with lots of screen shots) on how to perform common data-related patterns. The first three tutorials constructs the architecture used by the other tutorials. The first tutorial, Create a Data Access Layer, shows how to create a DAL using Typed DataSets. The second tutorial looks at building a custom Business Logic Layer on top of that DAL, while the third implements the framework for the presentation layer, crafting the master page and site navigation for the tutorials website. The remaining seven tutorials provided currently show how to perform common data access scenarios using the architecture. The third tutorial looks at using the ObjectDataSource to access data from the BLL, while tutorials four and five look at using parameters with the ObjectDataSource. Tutorials six through ten focus on master/detail reporting scenarios.

There will be a total of 38 (or so) tutorials - I've currently turned in the first 28 to Microsoft and will be starting #30 this week. In addition to displaying data, future tutorials will look at editing, inserting, and deleting data, using optimistic concurrency, paging and sorting through data, and so on, and includes a multitude of examples using the GridView, DetailsView, FormView, DataList, and Repeater controls. All in all, these 38 (or so) tutorials, if printed, would likely consume around 250 pages of printed material.

What I like best about these tutorials is the way they're packaged up and presented, and my hat's off to the editors at Microsoft. My favorite “features” of this tutorial series, which differentiates it from much of the standard content on the MSDN website, are:

  • All tutorials include both a C# and VB version
  • Each tutorial can be downloaded as a printable PDF; also, you can download a single PDF that has the entire content for the first 10 tutorials
  • When downloading the code, it downloads as an extractable ZIP file and not an MSI file; furthermore, you can download the code on a tutorial-by-tutorial basis, or download the entire code for the first 10 tutorials
  • The HTML and source code presented inline in the article is color coded

As more tutorials from the series come online, I'll be sure to blog about them here...
http://www.asp.net/Learn/DataAccess/

posted on Monday, June 12, 2006 9:02 AM

Feedback

# re: Working with Data in ASP.NET 2.0 6/12/2006 11:36 AM Vishal

very cool :) ... I am going through them right now. Looks great!
Thanks

# re: Working with Data in ASP.NET 2.0 6/12/2006 1:10 PM Kris van der Mast

Great news. It's always nice to see the Learn tab on the ASP.NET website grow with new content.

Grz, Kris.

# re: Working with Data in ASP.NET 2.0 6/14/2006 10:11 AM Will

Great content! I have been looking for these ever since Scott Gutherie first started talking about them a few months ago on his blog.

One nitpicky suggestion. The codewindows are fixed at 575px and it seems like for every example I am having to scroll over for the last 20 characters on that line even though there is plenty of room on the page. If the boxes were fluid, it would help the legibility of the code.

Thanks

# re: Working with Data in ASP.NET 2.0 6/14/2006 10:48 AM Tom H

thanks for getting these out, been looking at ScottGU's versions... great to have this as a resource.
BUT
The pdf for "Working with Data in ASP.NET 2.0 :: Master Pages and Site Navigation" tutorial seems to have the same image for all of them.

thanks again

# re: Working with Data in ASP.NET 2.0 6/14/2006 10:55 AM Scott Mitchell

Tom, thanks for the heads up, this will be fixed shortly.

# re: Working with Data in ASP.NET 2.0 6/14/2006 8:44 PM LaptopHeaven

Your tutorials are great. I just finished going through them.

I found a couple bugs, but nothing that was not easiely fixable. They were mainly in the FormView's. The Text field needed single quotes, not double quotes, because of the Bind command using the double quotes.

# re: Working with Data in ASP.NET 2.0 6/16/2006 3:24 AM cowgaR

I've expected you use CSS adapters (and rewrite some ScottGu work) instead of repeater in menu examples (masterpages).

# re: Working with Data in ASP.NET 2.0 6/17/2006 6:56 AM Hoang Nguyen

Your tutorials are awesome!!! I have been waiting for them and asking scott gu for the last couple of months. I'm going through them right now.

I am ,however, using oracle at work and sql express for my personal use. How do I go about creating the DAL and BLL using ODBC with Oracle (many of my projects at work are dependent upon this)? If you can point me somewhere or let me know how I would go about this, I would definitely appreciate it.

Thanks.
Hoang

# ODBC Parameters 6/17/2006 10:17 AM Hoang Nguyen

I figured out how to connect the database using ODBC by adding it to the server explorer. I just wanted to give you a heads up on how to set ODBC parameters if you didn't already know.

instead of...
WHERE CategoryID = @CategoryID

use...
Where CategoryID = ?
then go to TableAdapter and change parameter settings accordingly.

It took me 3 hours to figure this out and hoping someone could make use of this.
Hoang

# re: Working with Data in ASP.NET 2.0 6/20/2006 3:56 AM Graham Wilson

Nice article!

Personally, I don't like setting style information using ASP.NET. I guess this is a combination of avoiding inline styling and bad experiences of the nasty things .NET 1.0 did to the HTML/XHTML markup.

Good to see an article on GridView/DataGrid styling without someone dumping a whole load of style information into the markup!

# Stupid Question 6/27/2006 3:42 AM flipdoubt

Does the ObjectDataSource, or any data source for that matter, re-query the database at each post-back? I can tell its Selecting and Selected events fire, even when sorting.

# re: Working with Data in ASP.NET 2.0 6/27/2006 7:21 AM Scott Mitchell

flipdoubt, the data source controls requery the data when needed. This is on EVERY postback if the data Web control's view state is disabled. When sorting/paging, the data is re-requested on every different sort command and page index changing, yes.

# re: Working with Data in ASP.NET 2.0 6/27/2006 3:13 PM Sachin Joshi


Hi Scott,

The tutorial is awesome, there are lot of tips and tricks in these tutorials.

For example:
Using System.ComponentModel.DataObject
atribute to assist the ObjectDataSource control for configuration. It's like telling the ObjectDataSource control that X method is for SELECT, Y is for INSERT.

There are many such tips, it's an excellent tutorial.

Infact I have listed down the tutorial/download links for both C# and VB.Net.

http://www.fuzzydev.com/blogs/dotnet/archive/2006/06/25/three_tiered_data_architecture_with_ASPNET2.aspx

Great work!

# re: Working with Data in ASP.NET 2.0 7/3/2006 8:44 AM seb

Hi,

You write :
As we'll see in future tutorials, handling exceptions that bubble up from the BLL when using a data Web control for inserting, updating, or deleting data can be handled directly in an event handler as opposed to having to wrap code in try...catch blocks.

Where is this future tutorials ?

# Working with Data in ASP.NET 2.0 11/11/2007 10:18 PM The Breakdown

Need to learn about ASP.NET 2.0 data magic. Scott Mitchell has tutorials about working with data in ASP.NET

# Working with Data in ASP.NET 2.0 11/11/2007 10:19 PM The Breakdown

Working with Data in ASP.NET 2.0

Title:  
Name:  
Url:
Protected by Clearscreen.SharpHIPEnter the code you see:
Comments   

Add To Your Reader

My Links

Archives

Post Categories

 

I am a Microsoft MVP for ASP.NET.
I am an ASPInsider.
<May 2008>
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Comment Stats

DayTotal% of Total
Sunday 1866.8%
Monday 37913.9%
Tuesday 45316.7%
Wednesday 50418.5%
Thursday 53519.7%
Friday 49418.2%
Saturday 1666.1%
Total 2717100.0%

Hour1Total% of Total
12:00 AM 652.4%
1:00 AM 682.5%
2:00 AM 622.3%
3:00 AM 742.7%
4:00 AM 572.1%
5:00 AM 1033.8%
6:00 AM 1084.0%
7:00 AM 1585.8%
8:00 AM 1716.3%
9:00 AM 1475.4%
10:00 AM 1716.3%
11:00 AM 1816.7%
12:00 PM 1886.9%
1:00 PM 1696.2%
2:00 PM 1605.9%
3:00 PM 1324.9%
4:00 PM 1073.9%
5:00 PM 923.4%
6:00 PM 913.3%
7:00 PM 963.5%
8:00 PM 833.1%
9:00 PM 782.9%
10:00 PM 792.9%
11:00 PM 772.8%
Total 2717100.0%

Comments by Blog Entry Date/Time

Day Entry MadeAvg.Total
Sunday 5.54144
Monday 5.22339
Tuesday 4.28419
Wednesday 7.67637
Thursday 6.90607
Friday 5.48411
Saturday 5.33160
Total 5.842717

Hour1 Entry MadeAvg.Total
12:00 AM 5.0035
1:00 AM 1.002
5:00 AM 0.000
7:00 AM 7.0035
8:00 AM 5.35107
9:00 AM 6.32278
10:00 AM 6.47246
11:00 AM 4.41181
12:00 PM 6.88330
1:00 PM 3.00111
2:00 PM 5.41222
3:00 PM 8.64285
4:00 PM 4.0589
5:00 PM 5.92154
6:00 PM 4.52113
7:00 PM 9.67174
8:00 PM 9.80147
9:00 PM 5.05111
10:00 PM 5.4265
11:00 PM 4.5732
Total 5.842717

Learn More About Comment Stats
1 - All times GMT -8...


Blog Stats

Favorite Web Sites

My Books

My MSDN Articles