Microsoft KB Archive/817760

From BetaArchive Wiki

Article ID: 817760

Article Last Modified on 4/23/2003



APPLIES TO

  • MSPRESS Microsoft ASP .NET Programming With Microsoft Visual Basic .NET Step By Step Deluxe Learning Edition, ISBN 0-7356-1814-3



SUMMARY

This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Microsoft ASP .NET Programming With Microsoft Visual Basic .NET Step By Step Deluxe Learning Edition, 0-7356-1814-3.

The following topics are covered:

  • Page 14: Incorrect Path
  • Page 95: Error In Code Samples
  • Page 102: Error In Code Samples
  • Page 169: Typographical Error
  • Page 248: Error In Code Sample
  • Pages 296-297: Error In Code Sample
  • Page 317: Error In Code Sample
  • Page 326: Typographical Error
  • Page 350: Error In Code Sample
  • Page 469: Error In Code Sample
  • Page 471: Error In Code Sample
  • Page 566: Error In Code Sample



Page 14: Incorrect Path

There is an incorrect path at the bottom of page 14.

Change:
"C:\aspnetsbs"

To:
"C:\MS Press Books\ASPNETSBS"

Page 95: Error In Code Samples

The headings "Global.asax" and "Web Forms page" should be formatted as part of the code listing, not headings. The code samples should read:

'Global.asax
<object runat="server" id="MyClassInstance" class="MyClassName"
   scope="Application">
</object>



' Web Forms page
Response.Write("Value = " & MyClassInstance.MyValue)


Page 102: Error In Code Samples

The headings "Global.asax" and "Web Forms page" should be formatted as part of the code listing, not headings. The code samples should read:

'Global.asax
<object runat="server" id="MyClassInstance" class="MyClassName"
   scope="Session">
</object>

' Web Forms page
Response.Write("Value = " & MyClassInstance.MyValue)


Page 169: Typographical Error

There is a typograhical error in step 4 of the property table. Two controls are named Label2. The second label control should be named Label3.

Page 248: Error In Code Sample

There is an error in the code sample in Step 9 on page 248. The line break should be removed.

Change:
Label2.Text = "Your favorite is " _& DropDownList1.SelectedItem.Value & "!"

To:
Label2.Text = "Your favorite is " & DropDownList1.SelectedItem.Value & "!"

Pages 296-297: Error In Code Sample

There is an error in the code example in section 1. The connection string incorrectly uses "datasource" and "integratedsecurity" as parameters. The correct parameters are "data source" and "integrated security". The code samples should read:

'Default constructor
Dim mySqlCmd As New SqlCommand()

'Passing in a query
Dim SQL As String = "SELECT au_id FROM authors"
Dim mySqlCmd2 as New SqlCommand(SQL)

'Passing in a query and a connection
Dim mySqlConn As New _
   SqlConnection("data source=localhost\NetSDK;database=pubs;integrated security=true")
Dim SQL As String = "SELECT au_id FROM authors"
Dim mySqlCmd3 as New SqlCommand(SQL, mySqlConn)

'Passing in a query, a connection, and a transaction
Dim mySqlConn As New _
   SqlConnection("data source=localhost\NetSDK;database=pubs;integrated security=true")
Dim mySqlTrans As SqlTransaction = mySqlConn.BeginTransaction()
Dim SQL As String = "SELECT au_id FROM authors"
Dim mySqlCmd4 as New SqlCommand(SQL, mySqlConn, mySqlTrans)


Page 317: Error In Code Sample

The code listing for Step 6 of the DataTable Collections sample is missing a line of code just before the line that begins Value.Text &= "Table: " & _

The code sample for Step 6 should read:

'Get each DataTable in the DataTable Collection
'and display each row value by appending it to
'the Text property of the Literal control.

Dim CurrentTable As DataTable
Dim CurrentRow As DataRow
Dim CurrentColumn As DataColumn

For Each CurrentTable in MyDS.Tables
   Value.Text &= "Table: " & _
              CurrentTable.TableName.ToString() & "<br/>"
   Value.Text &= "-------------------------------------<br/>"
   For Each CurrentRow In CurrentTable.Rows
      Value.Text &= "<br/>   "
      For Each CurrentColumn in CurrentTable.Columns

         If Not CurrentRow(CurrentColumn) Is Nothing Then
            If Not IsDbNull(CurrentRow(CurrentColumn)) Then
               value.Text &= CStr(CurrentRow(CurrentColumn))
            Else
               Value.Text &= "NULL"
            End If
            Value.Text &= "<br/>   "
         End If
      Next
   Next
   Value.Text &= "---------------------------------<br/>"
   Value.Text &= "<br/><br/>"
Next


Page 326: Typographical Error

There is a typographical error in step 12 on page 326.

Change:
"types dataset"

To:
"typed dataset"

Page 350: Error In Code Sample

There is a typographical error in the code sample in Step 6 on page 350.

Change:
ConnStr = "server=(local)\VSdotNET;database=pubs;" & _ "Trusted_Connection=yes"Dim SQL As String

To:
ConnStr = "server=(local)\VSdotNET;database=pubs;" & _ "Trusted_Connection=yes" Dim SQL As String

Page 469: Error In Code Sample

There is an error in the CacheAuthors.aspx code sample on page 469.

Change:

Function GetData() As DataSet
   Dim myDS As New DataSet()
   Dim ConnStr As String
   ConnStr = "server=(local)\VSDotNET;"
   ConnStr &= "database=pubs;Trusted_Connection=yes"
   Dim SQLSelect As String
   SQLSelect = "SELECT au_id, au_lname, au_fname, "
   SQLSelect &= "zip FROM Authors WHERE zip = '94609'"
   Dim mySqlConn As New SqlConnection(ConnStr)
   Dim mySqlDA As New SqlDataAdapter(SQLSelect, ConnStr)
   mySqlDA.Fill(myDS)
   Return myDS
End Function


To:

Function GetData() As DataSet
   Dim myDS As New DataSet()
   Dim ConnStr As String
   ConnStr = "server=(local)\VSDotNET;"
   ConnStr &= "database=pubs;Trusted_Connection=yes"
   Dim SQLSelect As String
   SQLSelect = "SELECT au_id, au_lname, au_fname, "
   SQLSelect &= "zip FROM Authors WHERE zip = '94609'"
   Dim mySqlDA As New SqlDataAdapter(SQLSelect, ConnStr)
   mySqlDA.Fill(myDS)
   Return myDS
End Function


Because the SqlDataAdapter class can automatically open and close its own SqlConnection object, the SqlConnection object, mySqlConn, is not necessary.

Alternatively, you could explicitly create and open the connection, and pass it as an argument to the constructor of the SqlDataAdapter object. With this technique, you would also need to explicitly close the connection after filling and returning the DataSet to the caller.

Page 471: Error In Code Sample

The section entitled "Understanding Expiration and Scavenging" discusses how cached items are removed from the cache. This section contains a typographical error in the code example. The leading "Caching." on "Caching.CacheItemPriority.High" is incorrect.

The code sample at the bottom of page 471 should be:

Cache.Insert("myDS", myDS, Nothing, DateTime.Now.AddMinutes(2), _
   TimeSpan.Zero, CacheItemPriority.High, _
   Nothing)

Page 566: Error In Code Sample

There is an error in the HttpModules configuration section on page 566. One of the elements in this file is missing a closing "/>" bracket. The code sample should read:

<remove name="name" />

Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections.


Additional query words: 0-7356-1814-3

Keywords: kbdocfix kbdocerr KB817760