Data Tutorials for ASP.NET 2.0 – a set of 46 by Scott Mitchell

UPDATE: 46 tutorials, not 40 🙂 in the pipe

One area where we have seen a lot of interest in deep dive documentation is around working with data in ASP.NET 2.0.  As a result, we have comissioned that always amazing Scott Mitchell to build a step by step series of 40 data tutorials (end to end) to cover a wide variety of data scenarios to help you be successful.  The first 10 step by step articles are now published, with source code to get you started.  I expect we'll be posting about 10 more each 1-2 weeks until it is complete. 

from the homepage:

Working with data is one of the key aspects of creating a dynamic web site. The first set of ten (of 40 total) ASP.NET 2.0 data tutorials will help you build the basic functions needed to store and display content on your site. These tutorials are geared to be concise and provide step-by-step instructions with plenty of screen shots to visually walk you through the process.

You can get access to them at:

Let me know what you think, any feedback, or any issues!  I think this is an amazingly high quality series that you will love! 

Comments (30)

  1. Kris says:

    A very good collection of articles. Has already gone into my favorites list. I guess a lot of hard work went into it. Keep up the good work.

  2. bgold says:

    Glad you like em’ Kris — a lot more coming soon too.

  3. ks shekhawat says:


  4. Thaabiet74 says:

    Really appreciate the articles, a great source of help ad guidance.

  5. Derek says:

    These tutorials are great! Thank you. But I wish that we (the .net community) could have a video series or walk troughs that tackle more complex or real world scenarios. For example all of these tutorials use a single table in a database. What about a walk through were you have multiple relational tables that can be updated? Or how about porting a website to mobile device where the website has a lot of graphics and JavaScript? All the tutorials I come across are helpful but when I need to use them in normal scenarios I get trapped in situations where I should have done something else.

  6. Derek, thank you for your feedback. Also, for anyone reading this blog entry, you can contact me directly with feedback on the "Working with Data" Tutorials at

    Derek, the tutorials (as you know) are on the Nothwind database, so we have DataTables in the DAL for Products, Categories, Suppliers, and Employees, with the first three sharing relationships.

    The Products DataTable actually includes data from the related Categories and Suppliers table (CategoryName and SupplierName, in particular), and these values are brought back in the TableAdapter using subqueries. Ideally these would be brought back using JOINs. For the first three parts, however, I followed along very closely to the foundation laid by Scott Guthrie in his blog entries (see I believe Scott chose to use the subqueries because it allowed the update/insert/delete portions of the TableAdapter to be auto-generated (vs. having to enter them in manually).

    In the editing/inserting tutorials (which will be published on in a few weeks), there are examples where the user is prompted to enter a new product that includes providing supplier and category information. This is done using a DropDownList. Is this the type of interaction you are interested in? Also, in the custom paging with sorting tutorial, I use a stored procedure that does a join (since the ROW_NUMBER() function in SQL Server 2005 won’t work over results returned by subqueries).

    I can’t speak for Scott Guthrie, but I believe the decision for not using sprocs and not including JOINs in the DAL was to have the tutorial series focus more on working with data from an ASP.NET side of things – displaying, paging, sorting, editing, deleting, optimistic concurrency, custom paging, etc. – rather than on the data access side (writing sprocs, designing the database, making perf decisions at the query level, etc.)


  7. Pooja says:

    A very Helpful site.

    But, most of the developers doesn’t prefer to built a site using the design, but rather use more of coding in .CS file. If the examples include more of that, then it would have been more helpful.

  8. Quentin says:

    Hi All,

    Thanks, these tutorials are great, but my concern to is that I’m struggling a little using SP’s in ASP.Net 2.0. I put a great site together, but I could not get SP’s to update/insert data. The SP’s themselves work perfectly, but trouble passing params from the data controls etc caused me to abandon for Intraweb (Delphi). I needed to put a site together in a hurry, but became very frustrated with ASP.Net 2.0.

    Ok, Ok, I have not yet gone through all the current articles, but what I’ve seen so far is great.



  9. I’ve done some design template for ASP.NET 2 which i believe is a great compliment  for these tutorials. Check it out at

  10. I’ve done a design template for ASP.NET 2 that uses Master Pages and Themes which i believe is a good compliment for these series of tutorials. Please check it out at [url][/url]. Thanks!

  11. bgold says:

    Quentin — That is great feedback, we are working with Scott to do more tutorials on Data that include SPROC based data management — I think over the coming months we’ll have created a very comprehensive guide to data on ASP.NET 2.0

  12. Don says:

    Perfect timing.  I know absolutly nothing about ASP/VB/C#  and was looking for a source to learn.  These tutorials should get me off to a good start.  Much Thanks!

  13. EMar says:

    Great tutorials!

    I have two questions :

    in the code examples, it uses the directive :

    using NorthwindTableAdapters.

    How do you know that is the namespace to include?

    How do you know where do you look for it?

    Second question :

    Whenever coding the event handlers, all the specific classes

    are nested inside a  class defined as :

    public partial class Northwind

    Why is this?

    Thanks very much for any information you give me,


  14. EMar, for the answer to your first question, see:

    For the second question, is your question, "What is a partial class?" or "Why are partial classes used?" If it’s the former, see

    If it’s the latter, the reason is so that the functionality can be extended more easily. If the class wasn’t a partial class, in order to customize the auto-generated DataSet/DataTables/etc. you’d have to muck with the auto-generated code. The problem there is that whenever the code was re-generated, your custom changes would be obliterated. By using partial classes, the tool (Visual Studio) can manage its auto-generated pieces and you can extend the class without fear of having your changes affected.

    Happy Programming!

  15. EMar says:

    Hi Scott.

     Thanks very much for your answer. Just to make sure I understand, (int the article the link points to)you are saying

    that whenever I create a Datset, it’s type definitions will be inside a namespace called :

    ‘DataSetName’TableAdapters ?

    I’m asking again because when I want to find where the namespace NorthwindTableAdapters is defined, I can only find it in :


    Temporary ASP.NET Files"Project Name"


    I just wanted to be sure that all I have to do to use the proper namespace is add "TableAdapters" to the name of the dataset(is this documented somewhere?).

    The second question was not about partial classes, but about why are they all nested inside the Northwind class. Where does this class come from? Does it have to have the same name as the Dataset? What’s the reasoning/advantages for making them nested and choosing that particular name for  the containing class?

    Sorry if the questions are too simple, I’m a newbie!

    Thanks very much for your time,


  16. Steve says:

    I’d like to see some Domain Model examples with some ORM capability without the stored procs, ie. NHibernate

    Are you planning on this Scott?

    Perhaps something along the lines of how this article was done

    with some test cases, mock data, etc..

    I think with some mock tests, I could run these samples and not need the database to see how it works, etc…

    Just a suggestion – it seems the dataset/stored proc way is the preferred Microsoft solution?

  17. media_555 says:

    Really cool stuffs. Thanks a lot.

  18. Milos says:

    I like it! Clean code – good work! […] A very accosting layout and a interesting discussion topic, do you provide any Web-based services to universities or students. […]

    Greetings Milos

  19. Damir says:

    In a "Creating a Data Access Layer" tutorial, working with Wisual Web Developer and ODBC database (Progress) I can’t choose "Create methods …  GenerateDBDirectMethods)" (Fig.11).

    Is it a limitation  of WWD or ….? (ODBC Conn String).


    Damir Pem

  20. ytzy says:

    A very Helpful site. Thanks

  21. ytzy says:

    A very Helpful site. Thanks

  22. Rajendra Aryal says:

    Simply wow!

    Every details well explained. I printed out the entire pages (for C#).



  23. Vladislav says:

    Hi Scott,

    Articles look good before you dive into real world situations. Problem is that there are really no samples and information about creating DAL and BLL over SPs !

    Here are problems I had to think about:

    Do I need BLL classes when business logic is mostly contained in SPs.

    BLL appeared to be usefull because we cannot really change way generated TableAdapters work, even with partical classes feature.

    For example I don’t see a way to pass values to SP’ parameters in the dataset designer before VS.NET gets information about it’s result set columns. SPs I have can return different result sets depending on passed parameter values.

    Also there is no information about using default parameters in SPs. Can TableAdapter be changed so I can conditionally pass or not pass parameter to SP ?



  24. EMar says:


     I posted a question here a couple of days ago. It was about tutorial #23, and the need to set the DropDowList to AutoPostback, and the (lack of) need to re bind the DetailsView.

     I checked yesterday, it was here but had no answers.

     Today the question posted  is gone.

      If a post is deleted, does it mean that the questions

    are inappropiate?

     Is there any other place where I can post questions about these tutorials?

    Thanks for your time,


  25. bgold says:

    Sorry, i accidentally deleted the comment while trying to remove about 200 blog spams — my mistake — if you can repost your question that would be awesome and I’ll make sure Scott gets it and can respond.

    So totally my bad here, thanks for reposting!

  26. EMar says:

    Hi  bgold. No worries.

    The question is :

    In tutorial #23 (Limiting Data Modification Functionality Based on the User c#) he is using a DropDownList with "access levels" -where you can choose wether to edit all suppliers or just one- and a DetailsView to show supplier information.

     In order to get them in sync, the SelectedIndexChanged of the DropDownList sets the DataSourceID of the DetailsView and calls the DetailsView DataBind() method.

     This, as is, doesn’t work on my machine.

     I have to set the AutoPostback property of the DropDownList to true( which makes sense, and I just checked is also set to true in the source code for the article –c#).

     After setting the AutoPostback of the DropDownList to true, I don’t seem to need to call the DataBind() of the DetailsView anymore(it refreshes automatically).

     What am I doing wrong?

     Should it work without AutoPostback?

     Do I still need to call DataBind() if setting AutoPostBack to true?

    Thanks for your time,


  27. Hi EMar, this is Scott, the author of these tutorials. I’m not sure I follow you here. The DropDownList you refer to DOES have its AutoPostBack property set to True. Check out the code download.

    I see that in the tutorial text, the code snippet immediately before Figure 5 does NOT include the AutoPostBack="True" setting, but if you read in the paragraph right after Figure 5, it says: "Since we want to update the user interface immediately after the user has changed their selection, set the Suppliers DropDownList’s AutoPostBack property to true."

    And, yes, that SupplierDetails.DataBind() call in the SelectedIndexChanged event handler is superfluous. The call a couple lines above to SupplierDetails.ChangeMode(DetailsViewMode.ReadOnly) causes the DetailsView to set its RequiresDataBinding property to True, meaning it will "refresh" itself by the end of the page life cycle.


  28. EMar says:

    Hi Scott.

    Thanks very much for that, it answered my question. I did not know that ChangeMode affected the RequiresDataBinding, so I assumed it was the Postback done by the drop down list that caused the rebinding.

    And yes, the AutoPostback was my mistake(I missed the lines below figure 5). I am sorry for that, English is not my first language so I some times miss some things.

    Thanks for your answer,


  29. [来源:Brian Goldfarb] 微软请了Scott Mitchell撰写46个使用ASP.NET 2.0开发三层架构应用的step by step教程,着重于常见的数据访问模式,对初学者应该很有用。目前发表了10个,以后每1-2周会发表10个左右。目前发表的10个教程的内容包括:

Skip to main content