Errata for "A First Look at ADO.NET and System.Xml v2.0"

Addison Wesley, ISBN: 0-321-22839-1

 

With the subsequent release of Beta 1 of SQL Server "Yukon" and MDAC 9.0, there are some changes to the code for asynchronous command execution. The downloadable example files have been updated to take these changes into account, and the changes to the text of the book are summarized in the following table.

 

We have also improved the SQL scripts to make it easier to create the required sample databases, and clarified parts of the setup instructions.

 

 

Page

Details

15

The diagram at the top of the page shows a class named DbTable. This class was a temporary addition to the System.Data namespace, and has now been removed.

67

Listing 3.5. The code does not make clear the fact that the Command object must be declared outside any event handlers, subroutines or functions so that it is available in the callback event handler. For example, in an ASP.NET page (as shown in the downloadable samples) it must be declared as a page-level variable.

68

Line 2 of the code in Listing 3.6 should read:

Sub DisplayRows(oResult As IAsyncResult)

and line 4 should read:

Dim oReader As SqlDataReader = oCmd.EndExecuteReader(oResult)

68

Line 6 of the code in Listing 3.7 should read:

Dim oResult As IAsyncResult = oCmdBeginExecuteNonQuery()

69

Lines 3 to 7 of Listing 3.8 should be replaced as shown below:

  ... 

  ' use AsyncResult instance to create a WaitHandle

  Dim oHandle As WaitHandle = oResult.AsyncWaitHandle

  ' set the timeout to 10 seconds and tell code

  ' to sleep here until process is complete

  If oHandle.WaitOne(10000, False) = True Then

    ' process is complete so get results

    ...

74

Listing 3.14. The code does not make clear the fact that the Connection object must be declared outside any event handlers, subroutines or functions so that it is available in the callback event handler. For example, in an ASP.NET page it must be declared as a page-level variable.

117/8

The example code shown in Listing 4.14 through to 4.17 does not work with SQL Server "Yukon" Beta 1. This is currently under investigation.