Creating data classes for ASP.NET data controls
Part one of a seven-part series of blogs

Yes, ASP.NET provides DataSource controls, but wizards only get you so far. Share the secret of how Wise Owl create all our ASP.NET websites, using a single, simple data class.

  1. Data Classes in ASP.NET (this blog)
  2. Our Example for this Data Classes Tutorial
  3. Storing and Retrieving Connection Strings
  4. ADO.NET: DataSets, DataTables and Data Adapters
  5. Consuming our Data Classes
  6. A Class to Run a Stored Procedure and Return its Rows
  7. Consuming our Data Class on the Web Page

This blog is part of a larger online ASP.NET online tutorial.  For courses in VB programming or programming in C#, see the separate pages.

Posted by Andy Brown on 07 August 2012

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Data Classes in ASP.NET

This online tutorial shows how to create and use all the data classes in ASP.NET that you'll need!  Example code is given in C# and Visual Basic.

Should you Read this Tutorial?

If you're going to read and make use of this blog, it's important to realise who it's aimed at.  There are 3 types of software user:

Type Notes
The stickler This person prefers to code in C, because it's a proper programming language.  He (because sticklers usually are male) does everything the correct way.  Not only does he have a book on ADO.NET Unleashed on his bookshelf, but he's read it in its entirety.
The Hogwartian This person uses all the wizards provided by Microsoft, to make his or her life easier.  S/he often runs into the limitation of wizards, and so is usually a dabbler in software rather than a guru.
The business user This person is using software as a means to an end, rather than for its own sake.  S/he will learn as much as s/he needs to know to create a software application, and no more.

This is a bit of a caricature, but it will help you decide whether to read on.  This blog will:

  • Infuriate the stickler; and
  • Bewilder the Hogwartian.

It aims, however, to be exactly what the business user needs.

The blog will use SQL stored procedures throughout - if you don't know what these are, read my earlier blog on stored procedures to find out!

The rest of this blog is divided up as follows:

  1. Explaining the example we'll use.
  2. Understanding, storing and retrieving connection strings.
  3. Giving the rest of the background theory that you will need on data tables, datasets and data adapters (and only that!).
  4. How we'd like to consume our data classes.
  5. Creating our class to return a table of data.
  6. How our class is used on the web page.

There's a lot to cover, so let's make a start by looking at our example, which is -as ever - to do with movies. 

This blog has 0 threads Add post