You create typed Data Sets, which are defined by an XML schema and implemented by a very large amount of auto-generated VB 2005 code, with VS 2005 designers.Untyped Data Sets are runtime objects that you create with code. The section "Add a Data Grid View and Data Navigator Controls," later in this chapter, describes how the Binding Source fits into ADO. The following sections show you alternative methods for generating Figure 1-5's ADO.

updating typed datasets-1updating typed datasets-8

The datatable is then added to the dataset which is returned as the output of the function.

The code that calls this function could then reference the data within the dataset by referring to a specific table, rows and items.

Moving further down, each table can have multiple Data Row objects.

In effect, you can have an entire relational database in memory to which your application can refer and save changes, although in practice, I usually limit the data in memory to one datatable or even a single datarow if possible, so as to avoid using too much memory.

However, there are a number of essential points that developers and architects need to be aware of both in going down this route and actually negotiating the path.

This article covers various enhancements and additional benefits to this approach, as well as important caveats and potential pitfalls (and how they can be avoided) that are generally less well covered but are nonetheless important. will tell you, there are a number of individuals who are ardently against typed Data Sets.

The code examples in this section show how to pass a changes-only Data Set (that is, a Data Set that contains only records that have been added, updated, or deleted) to the App Server and properly process the changes.//Define two strongly-typed Data Setsusing Acme.

Strong Types NS;ds Order Data Set ds Orders;ds Order Data Set ds Updated Recs; . .// Populate the ds Updated Recs Data Set with only the changed rowsds Updated Recs = (ds Order Data Set) (ds Orders. Merge(ds Updated Recs); // Reset the row state for the modified rows now that changes ds Orders.

NET,' of the book Expert One-on-one Visual Basic 2005 Database Programming by Roger Jennings, courtesy of Wiley Publishers.

Click here for the complete collection of book excerpts. NET and typed Data Sets are the preferred method for retrieving and updating relational tables, although Data Sets aren't limited to processing relational data.

This can be useful, e.g., if some data validation is made in the procedure.