MCTS Self-Paced Training Kit (Exam 70-516): Accessing Data with Microsoft .NET Framework 4

Errata for MCTS Self-Paced Training Kit (Exam 70-516): Accessing Data with Microsoft .NET Framework 4




The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Other Digital Version
i
Practice Tests (Question ID 516P_1.1_09)

In the question part ther is a list list - it says: * All Person rows with a null EnrollmentDate and a nonnull HireDate must map to the Instructor type. * All Person rows with a nonnull EnrollmentDate and a null HireDate must map to the Instructor type. * Application code must be able to refer to both generated classes by using a common base class. In the second line it should probably be: * All Person rows with a nonnull EnrollmentDate and a null HireDate must map to the Student type.

Note from the Author or Editor:
On C# practice question ID 516P_1.1_09 Replace: All Person rows with a nonnull EnrollmentDate and a null HireDate must map to the Instructor type. With: All Person rows with a nonnull EnrollmentDate and a null HireDate must map to the Student type.

Anonymous  Jan 03, 2012 
Printed
Page I
"Getting Started with the DbConnection Object" Section

In the table "Table 2-1. Primary Provider Classes and Interfaces in ADO.NET" SqlPermission doesent exist it should be replaced by SqlClientPermission

Note from the Author or Editor:
On page 66, Table 2-1 Locate: SqlPermission Replace with: SqlClientPermission

Khalid Bouam  Dec 13, 2012 
Printed
Page 7
Exam Tip

AutoIncrementStep is spelled wrong. Should read "AutoIncrementStep and AutoIncrementSeed" instead of "AutoIncementStep and AutoIncrementSeed".

J. Dodger  Jul 04, 2011  Aug 12, 2011
PDF
Page 8
4th paragraph

ImportDataRow method does not exist. It should be ImportRow method.

Stephie Murdoch  Jul 28, 2011  Aug 12, 2011
PDF
Page 10
Top of the page

The description for the "Deleted" DataRowState might be made clear. It reads: "An attached data row is deleted by using the Delete method of the DataRow object or when it is removed from its table by calling the DataTable.DeleteRow method." Only DataRow.Delete is a viable option, the other method DataTable.DeleteRow cannot be called directly since it's marked as internal. Would you consider removing any reference to it as it's causing confusion, in my opinion. Also, using DataRowCollection.Remove is possibile as well, but that would remove the DataRow completely making the DataTable unable to recover it if .RejectChanges was then called. http://msdn.microsoft.com/en-us/library/feh3ed13%28v=VS.100%29.aspx

Note from the Author or Editor:
Please change the Deleted DataRowState to look like the following, where the last part of the existing statement is removed: An attached data row is deleted by using the Delete method of the DataRow object.

Moreno Gentili  Jul 16, 2011  Aug 12, 2011
PDF
Page 12
Sample of Visual Basic Code

Dim retVal As String = String.Format( _ "RowState: {0}" + vbCrLf should be replaced with Dim retVal As String = String.Format( _ "RowState: {0}" + vbCrLf, row.RowState);

Merrick Karya Wirawan  Jun 27, 2011  Aug 12, 2011
PDF
Page 13
1st paragraph

In the 4th line it says : "In a typical data environment (after data has been loaded), the DataRow state of the loaded rows is set to Added. Calling AcceptChanges on the data table resets the row state of all the DataRow objects to Unchanged." However, actually the DataRow state of the loaded rows is always set to Unchanged.

Note from the Author or Editor:
On page 13, locate the following: "In a typical data environment (after data has been loaded), the DataRow state of the loaded rows is set to Added. Calling AcceptChanges on the data table resets the row state of all the DataRow objects to Unchanged." Replace with: "In a typical data environment (after data has been loaded), the DataRow state of the loaded rows is set to Added. Calling AcceptChanges on the data table resets the row state of all the DataRow objects to Unchanged (Depending on how you loaded the data, this call may have been made automatically for you). "

Mohamed Elhadi  Oct 20, 2012 
PDF
Page 13
the note at the bottom of the page

The note says : "Remember that it is important to call the AcceptChanges method after you have made a successful update to the database server because the AcceptChanges method marks all rows as Unchanged. Why? Because the rows are now synchronized with the rows at the database server." However, there is no need to call AcceptChanges after an update, in fact, the update method calls the Accepchanges method internally when the update succeeds.

Note from the Author or Editor:
On page 13, locate the following: "Because the rows are now synchronized with the rows at the database server." Replace with: "Because the rows are now synchronized with the rows at the database server. (Depending on how you loaded the data, this call may have been made automatically for you). "

Mohamed Elhadi  Oct 20, 2012 
PDF
Page 14
Sample of Visual Basic Code

For Each dr As DataRow In dt.Rows should be replaced with For Each dr As DataRow In cars.Rows

Merrick Karya Wirawan  Jun 27, 2011  Aug 12, 2011
PDF
Page 21
2

in C# Sample Code DataTable part = vendorData.Tables.Add("Parts"); Is Wrong It Must Be parts DataTable parts = vendorData.Tables.Add("Parts"); In The Folowing lines parts Is Userd parts.Columns.Add("Id", typeof(Guid)); parts.Columns.Add("VendorId", typeof(Guid)); parts.Columns.Add("PartCode", typeof(string)); parts.Columns.Add("PartDescription", typeof(string)); parts.Columns.Add("Cost", typeof(decimal)); Not part

Ali Azhdari  Jun 19, 2011  Aug 12, 2011
PDF
Page 21
Sample of Visual Basic Code

Dim vendor as DataTable = vendorData.Tables.Add("Vendors") should be replaced with Dim vendors as DataTable = vendorData.Tables.Add("Vendors")

Merrick Karya Wirawan  Jun 27, 2011  Aug 12, 2011
PDF
Page 26
Last line

In C# Sample Code Again Instead Of parts We have part ForeignKeyConstraint fk =(ForeignKeyConstraint)part.Constraints["vendors_parts"]; It Must Be ForeignKeyConstraint fk =(ForeignKeyConstraint)parts.Constraints["vendors_parts"];

Note from the Author or Editor:
Please change both the Visual Basic and the C# reference from the singular part to the plural parts.

Ali Azhdari  Jun 19, 2011  Aug 12, 2011
Printed
Page 26
2nd paragraph, last sentence

The sentence states "You can set ChangeRule to a member of the Rule enumeration to get the appropriate behavior." ForeignKeyConstraint does not contain a "ChangeRule" property. "ChangeRule" should be replaced with "DeleteRule".

Note from the Author or Editor:
On page 26, locate the following: ChangeRule Replace with: UpdateRule

Jon Senchyna  Sep 21, 2012 
PDF
Page 27
Last

In C# Sample Code There is No person It Must Be people. VB Code Is OK But C# Must Be Correct Wrong : people.PrimaryKey = new DataColumn[] { person.Columns["Id"] }; Right : people.PrimaryKey = new DataColumn[] { people.Columns["Id"] };

Ali Azhdari  Jun 19, 2011  Aug 12, 2011
PDF
Page 28
2nd paragraph

The AddWithKey value is selected, which means the Sales data table and its data are added to masterData. Table 1-7 describes the enumeration members. "Sales data table" should be "Orders data table"

Note from the Author or Editor:
Page 28 Replace: Sales data table With: Orders data table

Mark Kniffen  Oct 08, 2011 
Printed, PDF, Safari Books Online
Page 33
Question #2

Text says: "You want to set up a primary key column. Which properities on the data column must be set". The answer on page 601 is B, C, D is incorrect. The answer would be correct if the text was changed to: "You want to set up an auto-number primary key column. Which properities on the data column must be set".

Note from the Author or Editor:
On page 33, replace: You want to set up a primary key column. Which properities on the data column must be set with: You want to set up an auto-number primary key column. Which properities on the data column must be set

Anonymous  May 03, 2012 
Printed, PDF
Page 34
United States

At the end of the page, it states "If this code is executed on the cars DataSet defined in the previous lesson...". DataSet should be replaced with DataTable.

Note from the Author or Editor:
At the bottom of page 34, location DataSet and replace it with DataTable.

Gurkan Sokat  Mar 19, 2012 
Printed, PDF
Page 35
United States

In the second paragraph, second sentence, "To change the name of the repeating element for the DataRow objects from Car to Auto, you can change...". Car should be replaced with Cars.

Note from the Author or Editor:
Page 35, In the second paragraph, second sentence, "To change the name of the repeating element for the DataRow objects from Car to Auto, you can change...". Please change Car to Cars.

Anonymous  Mar 19, 2012 
PDF
Page 41
Sample of vb code Line 7

Dim vendor as DataTable = vendorData.Tables.Add("Vendors") should read as Dim vendors as DataTable = vendorData.Tables.Add("Vendors")

Note from the Author or Editor:
On page 21, locate the following: Dim vendor as DataTable = vendorData.Tables.Add("Vendors") Replace with: Dim vendors as DataTable = vendorData.Tables.Add("Vendors")

Munawar Hayat  Nov 20, 2012 
PDF
Page 44
Sample of Visual Basic Code

Dim fs as new FileStream( _ desktopFileName("VendorData.bin",FileMode.Create) should be replaced with Dim fs as new FileStream( _ desktopFileName("VendorData.bin"),FileMode.Create)

Note from the Author or Editor:
This change needs to be applied to the Visual Basic and C# Code. Here is the Visual Basic change: Dim fs as new FileStream( _ desktopFileName("VendorData.bin"),FileMode.Create) Here is the C# change: FileStream fs = new FileStream( desktopFileName("VendorData.bin"),FileMode.Create);

Merrick Karya Wirawan  Jun 28, 2011  Aug 12, 2011
Printed
Page 47
1st paragraph

should say, "if you are using a DataTableReader to iterate over the rows in a DataTable object, you will _not_ be able to add or remove rows"

Note from the Author or Editor:
I see the need to tweak this as follows: For example, if you are using a DataTableReader object to iterate over the rows in a DataTable object, you won’t be able to use the DataTableReader object to modify the rows, but you will be able to access the DataTable object in your looping code to directly add or remove rows.

Rusty Divine  Aug 08, 2011  Aug 12, 2011
PDF
Page 47
In the middle

"The DataTableReader class contains a method called Read [...] If the end of data is reached, the Read method returns null". Correction: the Read method would return false, in that a case. In fact, all of the classes implementing IDataReader have a Read method that returns a boolean. Ref: http://msdn.microsoft.com/library/system.data.datatablereader.read.aspx

Note from the Author or Editor:
Page 47: Replace: The DataTableReader class contains a method called Read that is executed to load DataTableReader with the data row at the current position, and then the position is advanced. If the end of data is reached, the Read method returns null. Any attempt to execute the Read method after the end of data is reached will always return null, even if more DataRow objects are added. With: The DataTableReader class contains a method called Read that is executed to load DataTableReader with the data row at the current position, and then the position is advanced. If the end of data is reached, the Read method returns false and no data is loaded. Any attempt to execute the Read method after the end of data is reached will always return false and no data will be loaded, even if more DataRow objects are added.

Moreno Gentili  Aug 17, 2011 
Printed
Page 49
Sample of Visual Basic Code

Dim theCar = CType(cars.Rows(0)("CarObject"), Car) should be replaced with Dim theCars = CType(cars.Rows(0)("CarObject"), Car) and Return Car should be replaced with Return cars (and accordingly the Sample of C# Code on page 50)

Note from the Author or Editor:

Anonymous  Jul 14, 2011  Aug 12, 2011
Printed, PDF, Safari Books Online, Other Digital Version
Page 52
Bullet points

If we talk about DropDownList, ListBox or RadioButtonList from the System.Web.UI.WebControls namespace (which is generally the case in a ASP.NET Web Form application), the two properties DisplayMember and ValueMember sould be respectively DataTextField and DataValueField. DisplayMember and ValueMember does not exist in this context.

Note from the Author or Editor:
On page 52: locate bullet point with title of DisplayMember and change DisplayMember to DataTextField. Locate bullet point with title of ValueMember and change ValueMember to DataValueField.

Frédéric Hewitt  Jul 10, 2012 
Printed, PDF, Safari Books Online, Other Digital Version
Page 60
Case Scenario 1, Question 3

Question 3 deals with connected data access classes SqlConnection and SqlDataAdapter, neither of which are mentioned until Chapter 2 in the book.

Note from the Author or Editor:
On page 602, locate Chapter 1, Case Scenario 1, Answer 3. Insert "(covered in next chapter)" so the answer looks like this: You can use the provider classes (covered in the next chapter) to send changes back to the database server. SqlConnection can connect to the database server. The SqlDataAdapter class gets the changes in each data table, and SqlDataAdapter has SqlCommand properties for select, insert, update, and delete.

Chris Markworth  Jul 23, 2012 
Printed, PDF, Safari Books Online
Page 69
3rd connection string example

Missing semi-colon after: Trusted_Connection=yes

Note from the Author or Editor:
On page 69, replace: Trusted_Connection=yes with Trusted_Connection=yes;

Niklas Bergek  May 09, 2012 
Printed, PDF
Page 69
First paragraph in "Configuring an OLEDB Connection String" section

Last sentence (which refers to Table 2-3) should refer to OLEDB rather than ODBC connection strings.

Note from the Author or Editor:
On page 69, locate the following: Embedding for Databases (OLEDB). Table 2-3 describes the most common ODBC connection Replace with: Embedding for Databases (OLEDB). Table 2-3 describes the most common OLEDB connection

Mike de Jong  Sep 18, 2012 
Printed, PDF, Safari Books Online
Page 86
Final paragraph

Code calls stored procedure called "CustOrderHist" not "uspGetCustomerById" as suggested in the final paragraph.

Note from the Author or Editor:
On page 86, locate uspGetCustomerById and change it to CustOrderHist.

Jason James  Aug 10, 2011 
Printed, PDF, Safari Books Online
Page 88
Sample of C# Code (continuing from the previous page)

using (var connection = new SqlConnection()) { connection.ConnectionString = nw.ConnectionString; var cmd = connection.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE ProductID = connection.Open(); count = cmd.ExecuteNonQuery(); } Missing text. Should be: "UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE ProductID = 10"

Note from the Author or Editor:
On page 88 Replace: "UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE ProductID = With: "UPDATE Products SET UnitPrice = UnitPrice * 1.1 WHERE ProductID = 10"

Jukka Konttinen  Nov 08, 2011 
Printed, PDF
Page 89
2nd paragraph

"..retrive the number of rows in the Sales table directly..." Sales in this sentence should be replaced with Products since the sample code is for retrieving the number of rows in Products table.

Note from the Author or Editor:
On page 89, end of second paragraph, locate: "..retrive the number of rows in the Sales table directly..." replace Sales with Products.

Gurkan Sokat  Apr 15, 2012 
Printed
Page 90
Last paragraph

"...using the default PreserveCurrentValues enumeration value" should be "...using the default PreserveChanges enumeration value".

Note from the Author or Editor:
Page 90 Replace: PreserveCurrentValues With: PreserveChanges

David C. Haas  Sep 09, 2011 
Printed, PDF
Page 94
in sample vb code

bc.DestinationTableName = "StoreList", Storelist in this line should be replaced with CustomerList since it is mentioned in the previous paragraph. C# code is correct.

Note from the Author or Editor:
On page 94, in the VB code, locate: bc.DestinationTableName = "StoreList" Replace "Storelist" with "CustomerList"

Gurkan Sokat  Apr 15, 2012 
PDF
Page 95
first paragraph

in the third line "For example, the preceding code sample retrieved only the STORE names" should read "For example, the preceding code sample retrieved only the CUSTOMER names"

Note from the Author or Editor:
in the third line "For example, the preceding code sample retrieved only the STORE names" should read "For example, the preceding code sample retrieved only the customer names and IDs. The retrieved data could be further limited by adding a WHERE clause to the SQL statement. "

Donaciano Rojas  Jun 29, 2011  Aug 12, 2011
Printed, PDF, Safari Books Online, Other Digital Version
Page 97
United States

In the last paragraph, in the sentence "DbDataAdapter is great for ad hoc changes and demos, but it's generally better to use stored procedures...", I was wondering if you meant DbCommandBuilder instead, since I believe you can still use stored procedures with DbDataAdapter.

Note from the Author or Editor:
On page 97, locate: DbDataAdapter is great for ad hoc changes and demos Replace with: DbCommandBuilder is great for ad hoc changes and demos

Chris Markworth  Jul 25, 2012 
PDF
Page 101
Sample of Visual Basic Code

Public Enum DbProvider SqlClient OleDb Odbc End Enum should be replaced with Public Enum DbProvider SqlClient OleDb Odbc Oracle End Enum

Note from the Author or Editor:
Actually this enum should stay as is because the Oracle provider has been obsoleted. Instead please remove the following from the Visual Basic code on page 102: Case DbProvider.Oracle connection = New System.Data.OracleClient.OracleConnection() Also, please remove the following from the C# code on page 102: case DbProvider.Oracle: connection = new System.Data.OracleClient.OracleConnection(); break;

Merrick Karya Wirawan  Jun 30, 2011  Aug 12, 2011
Printed, PDF, Safari Books Online, Other Digital Version
Page 113
4th line of sample code

The SqlParameter added to the cmdUpdateRepairs SqlCommand for @OriginalDescription has an incorrect column size. It is shown as 20, when it should be 60 to match the other parameter definitions. Code: cmdUpdateRepairs.Parameters.Add("@OriginalDescription", SqlDbType.VarChar, 20, "Description").SourceVersion = DataRowVersion.Original; Should be: cmdUpdateRepairs.Parameters.Add("@OriginalDescription", SqlDbType.VarChar, 60, "Description").SourceVersion = DataRowVersion.Original;

Note from the Author or Editor:
On Page 113 Locate: cmdUpdateRepairs.Parameters.Add("@OriginalDescription", SqlDbType.VarChar, 20, "Description").SourceVersion = DataRowVersion.Original; Change to: cmdUpdateRepairs.Parameters.Add("@OriginalDescription", SqlDbType.VarChar, 60, "Description").SourceVersion = DataRowVersion.Original;

Ben Golden  Jun 07, 2012 
Printed, PDF
Page 122
First sentence after table

"The following is a description of the concurrency levels that ..." concurrency in this sentence should be replaced with isolation.

Note from the Author or Editor:
On page 122, locate the first sentence after the table. Replace concurrency with isolation.

Gurkan Sokat  Apr 16, 2012 
Printed, PDF
Page 134
Last line of the first paragraph

You state that "Even though these connection objects use the same connection string, [...they] will cause the single transaction to be promoted to a distributed transaction." This is only true for SQL Server 2005. See the following MSDN article: http://msdn.microsoft.com/en-us/library/ms172070(v=vs.90).aspx "Starting with SQL Server 2008 and version 3.5 of the .NET Framework, local transactions are no longer promoted to distributed transactions if another connection is opened in the transaction after the previous transaction is closed." I think this is very much worth mentioning and maybe the code example could be re-commented to explain promotion functionality in different SQL Server versions.

Note from the Author or Editor:
On page 134, locate the following: they are different connection objects, which will cause the single transaction to be promoted to a distributed transaction. Replace with: they are different connection objects, which will cause the single transaction to be promoted to a distributed transaction if using SQL Server 2005, but later releases of SQL Server do not promote to a distributed transaction.

Chris Markworth  Jul 26, 2012 
PDF
Page 140
Question 3, Answer B

Should be DataDiff. There is no other mention of DataGram in the book.

Note from the Author or Editor:
please change DataGram to DiffGram as described on page 42 and elsewhere

Anonymous  Jul 21, 2011  Aug 12, 2011
PDF
Page 179
End of Sample code

The result is only showing 99, is missing the value 2008 for the year

Note from the Author or Editor:
Please change the result to look like the following: The result: 99 2008

Donaciano Rojas  Jul 03, 2011  Aug 12, 2011
Printed
Page 187
Middle of the Page

To get the result for the SKIP query extension method as described the code samples must be changed from scores.OrderBy to scores.Distinct.OrderBy. Otherwise the result is: 23 56 65 78 88 90 93 99 99

Note from the Author or Editor:
rather than change the code, we will change the result to show as: The result: 56 65 78 88 90 93 99 99

Anonymous  Jul 28, 2011  Aug 12, 2011
Printed, PDF, Safari Books Online
Page 188
SKIP

This Errata was incorrectly corrected. the real output with the code in Book is: 23 56 65 78 88 90 93 99 99 Because the Skip over 1 only skyp the first element that is 23 (23 is repeated in the array)

Note from the Author or Editor:
Replace Dim scores = {88, 56, 23, 99, 65, 93, 78, 23, 99, 90} with Dim scores = {88, 56, 23, 99, 65, 93, 78, 99, 90} AND Replace int[] scores = { 88, 56, 23, 99, 65, 93, 78, 23, 99, 90 }; with int[] scores = { 88, 56, 23, 99, 65, 93, 78, 99, 90 };

Freedeveloper  May 16, 2012 
Printed, PDF, Safari Books Online
Page 214
VB Code

The loop for the page must be like this: For i = 0 To pageCount -1 The code C# is correct as it is written: i < pageCount Otherwise an additional page header is displayed with no item in it.

Note from the Author or Editor:
On page 214 Replace: For i = 0 To pageCount With: For i = 0 To pageCount -1

Anonymous  Nov 09, 2011 
Printed, PDF
Page 217
Last sentence (continues onto 218)

The book states "If you need to perform a join on multiple keys, use the Visual Basic And keyword or the && C# operator." This is incorrect - to perform a composite key join, you must construct an anonymous type on each side. For example: from c in cars join c2 in cars on new { c.Manufacturer, c.ModelYear } equals new { c2.Manufacturer, c2.ModelYear } ... The field names, types and order must match between the two anonymous types.

Note from the Author or Editor:
On page 217, locate the following: If you need to perform a join on multiple keys, use the Visual Basic And keyword or the && C# operator. Replace with: If you need to perform a join on multiple keys, use the Visual Basic And keyword. In C# you need to construct an anonymous type for each side of the equals. join c2 in cars on new { c.Manufacturer, c.ModelYear } equals new { c2.Manufacturer, c2.ModelYear }

Anonymous  Aug 28, 2012 
Printed, PDF
Page 219
C# Code

"var carsWithRepairs = from c in cars join r in repairs on c.VIN equals r.VIN into g from r in g.DefaultIfEmpty() orderby c.VIN, r == null ? 0 : r.Cost select ..." In the outer join description in the previous page, variables "rep" and "temp" are mentioned but not used in C# code. It looks fine in Visual Basic code. The correct formatted form should be like below: "var carsWithRepairs = from c in cars join rep in repairs on c.VIN equals rep.VIN into temp from r in temp.DefaultIfEmpty() orderby c.VIN, r == null ? 0 : r.Cost select..."

Note from the Author or Editor:
On page 219, locate starting on 3rd line: var carsWithRepairs = from c in cars join rep in repairs on c.VIN equals rep.VIN into temp from r in temp.DefaultIfEmpty() orderby c.VIN, r == null ? 0 : r.Cost and replace with: var carsWithRepairs = from c in cars join rep in repairs on c.VIN equals rep.VIN into temp from r in temp.DefaultIfEmpty() orderby c.VIN, r == null ? 0 : r.Cost

Gurkan Sokat  Apr 29, 2012 
Printed, PDF, Safari Books Online, Other Digital Version
Page 232
First paragraph of Lesson Summary

The first paragraph reads: This lesson provided a detailed overview of the ADO.NET disconnected classes. However, this lesson was about using LINQ queries, not disconnected classes. Disconnected classes were discussed in the first chapter.

Note from the Author or Editor:
On page 232 locate: This lesson provided a detailed overview of the ADO.NET disconnected classes. change to: This lesson provided an introduction to LINQ.

Ben Golden  Jun 12, 2012 
PDF
Page 234
Case Scenario 2:Sorting and Filtering Data

In the table 3-3 in the Second Column the Order table is missing the CustomerID Foreign Key and the Third Columne the OrderItem is missing the OrderID.

Note from the Author or Editor:
Please change the table to look like the following: CUSTOMER ORDER ORDERITEM CustomerID OrderID OrderItemID Name CustomerID OrderID Address OrderDate ProductID City RequiredDate Quantity State ShippedDate Price Discount

Donaciano Rojas  Jul 03, 2011  Aug 12, 2011
Printed, PDF
Page 257
Step 8

In order to add a connection when using SQL Express, type ".\SQLEXPRESS" - not "./SqlExpress" as stated.

Note from the Author or Editor:
On page 257, step 8 (forward slash to backslash) Replace: ./SQLExpress With: .\SqlExpress

Mike de Jong  Sep 19, 2012 
Printed
Page 260
Code samples

Code sample for Visual Basic shows C# code. It should be something like this: Private Sub mnuProjection_Click(ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) Dim ctx = New NorthwindDataContext() Dim sw = New StringWriter() ctx.Log = sw Dim customers = From c In ctx.Customers Where c.CompanyName.Contains("Restaurant") Order By c.PostalCode Select c dg.ItemsSource = customers MessageBox.Show(sw.GetStringBuilder().ToString()) End Sub

Note from the Author or Editor:
here is the actual Visual Basic code: Private Sub mnuBasicQuery_Click(ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) Dim ctx = New NorthwindDataContext() Dim sw = New StringWriter() ctx.Log = sw Dim customers = From c In ctx.Customers Where c.CompanyName.Contains("Restaurant") Order By c.PostalCode Select c dg.ItemsSource = customers MessageBox.Show(sw.GetStringBuilder().ToString()) End Sub

Anonymous  Jul 31, 2011  Aug 12, 2011
Printed
Page 270
Practice Exercise

The projects on the companion CD do not compile (Both Chapter 4\VB\Lession 1 Practice\Complete and Lession 2 Practice\Complete).. Files are missing/invalid.

Note from the Author or Editor:
This appears to be a problem. I would like to email Chapter 4 Labs to someone at O'Rielly so they can be replaced.

Anonymous  Nov 09, 2011 
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 327
First bullet point

GetPrefixOfNamespace bullet point does not contain explanation. Intellisense says : An System.Xml.Linq.XNamespace that contains the default namespace of this System.Xml.Linq.XElement.

Note from the Author or Editor:
My copy is correct, but please verify that on page 327 first bullet should be: GetPrefixOfNamespace A method that returns the prefix of the current element as a string.

Frederic Hewitt  Aug 31, 2012 
PDF
Page 355
Lesson Summary Section

Reads: This lesson provided detailed information about transforming data by using "LINQ to SQL". Should read This lesson provided detailed information about transforming data by using "LINQ to XML".

Donaciano Rojas  Jul 10, 2011  Aug 12, 2011
Printed, PDF, ePub, Mobi, Safari Books Online, Other Digital Version
Page 363
table, 4th row, 3rd column

"More time required but has mode features" should be "More time required but has more features".

Note from the Author or Editor:
On page 363, locate the following: More time required but has mode features Replace with: More time required but has more features

Frederic Hewitt  Sep 10, 2012 
Printed, PDF
Page 363
Table 6-2: File Types

"CDSL" (in File Types for Entity Framework) should read "CSDL"

Note from the Author or Editor:
On page 363, locate the following: CDSL replace with: CSDL

Mike de Jong  Sep 24, 2012 
Printed
Page 365
2nd paragraph.

"The Entity Framework supports two types of development, Database First and Code First." "With Code First development, you create your model, and, from the model, you can generate your database." These should read: "The Entity Framework supports type types of development, Database First and Model First." "With model first development..." As of EF 6.1, there are three types of development, and Code First is the most recent. The Database First and Model First types predate Code First. Creating the database from the model is Model First. Coding classes and creating the database from them is Code First.

None  Jul 15, 2011  Aug 12, 2011
Printed
Page 365
2nd bullet at top of page

"The Entity Framework supports type types of development..." should read, "The Entity Framework supports two types of development..."

Note from the Author or Editor:
On page 365, please change The Entity Framework supports type types of development To The Entity Framework supports two types of development

Mike de Jong  Sep 24, 2012 
Printed
Page 365
Netherlands

This is a correction on a correction. In the errata list there are corrections by ChiBelly concerning the meaning of 'code first'. Although he is correct code first was introduced in EF 4.1 and not in 6.1 as stated.

Note from the Author or Editor:
I don't have the corrected errata, but the statement is correct. "This is a correction on a correction. In the errata list there are corrections by ChiBelly concerning the meaning of 'code first'. Although he is correct code first was introduced in EF 4.1 and not in 6.1 as stated." If it states 6.1, please change to 4.1

Martijn Muurman  Dec 21, 2012 
Printed
Page 366
Last two paragraphs and heading

References to "Code First" should be named "Model First." "Code First" means something quite specific as of EF 6.1. What's being described here is normally called "Model First."

None  Jul 15, 2011  Aug 12, 2011
Printed, PDF
Page 401
1st paragraph below "Sample of New XML" code

"CDSL" in "The CDSL-to-SSDL (C–S) mapping content..." should be "CSDL".

Note from the Author or Editor:
On page 401, please change: CDSL to CSDL

Mike de Jong  Sep 24, 2012 
Printed, PDF
Page 412
2nd section of "Other POCO Considerations"

Bullet point states - "Your POCO class getters and setters can have ... but none of the mapped properties can be overridable (C# virtual) This is not true. For POCO classes to be tracked by a proxy they explicitly MUST be marked as virtual

Note from the Author or Editor:
Page 412 Replace: Your POCO class getters and setters can have any access modifier (public, private, and so on), but none of the mapped properties can be overrideable (C# virtual), and you can’t specify that you require partial trust support. With: Your POCO class getters and setters can have any access modifier (public, private, and so on), but none of the mapped properties can be NonOverrideable (C# sealed), and you can’t specify that you require partial trust support.

Jeremy Peaks  Sep 20, 2011 
Printed, PDF
Page 413
XML sample

When executed, the expression as stated does not correctly apply the discount. The SQL that is generated includes "CAST( 1 - [Extent1].[Discount] AS decimal(18,0))". Because the scale is 0, this term always equals 1. To fix: replace "CAST(1 - od.Discount AS DECIMAL)" by "CAST(1 - od.Discount AS DECIMAL(18,2))".

Note from the Author or Editor:
On page 413, locate the following: CAST(1 - od.Discount AS DECIMAL) replace with: CAST(1 - od.Discount AS DECIMAL(18,2))

Mike de Jong  Sep 28, 2012 
PDF
Page 415
Design a Database to Track Music, first paragraph

In Entity Framework there is a Model First, Database first and Now a new Code First model. Why did you call the Model First Model the Code First model? Thanks

Note from the Author or Editor:
I coined Code First to mean Model First, and then Microsoft actually came out with something different, and named it Code First. Please change all Code First references to Model First.

Donaciano Rojas  Jul 14, 2011  Aug 12, 2011
Printed
Page 416
Step 14, second paragraph and schema 6-24

The paragraph state : "An album can have many songs, and a song can be on one album, many albums, or no album" It's wrong. This is the description for a many to many association which is not the case here. The text should says: "An album can have many songs, and a song can be on one album or no album". Also, the figure 6-24 on page 417 does not match the description. The left side of the association is labelled "1" but should be labelled "0..1".

Note from the Author or Editor:
On page 416, locate the following at the bottom of the page: An album can have many songs, and a song can be on one album, many albums, or no album Replace with: An album can have many songs, and a song can be on one album or no album

Frederic Hewitt  Sep 10, 2012 
PDF
Page 437
2nd paragraph

NoTacking should read NoTracking

Donaciano Rojas  Jul 15, 2011  Aug 12, 2011
Printed
Page 440
First paragraph

The book (and also the practice exam on the cd) states that all the entities should be loaded for a cascading delete to work. But if you check the following information: http://blogs.msdn.com/b/alexj/archive/2009/08/19/tip-33-how-cascade-delete-really-works-in-ef.aspx then this states clearly this is not a recommend practice. You should specify the cascading delete also in the database. This way you won't have to load all the data.

Note from the Author or Editor:
Locate: It’s important to note that a cascading delete in the Entity Framework works only if the dependent entity objects are loaded. Insert this paragraph Before the Located Text: If you add an Cascade delete rule to the model, you should have a corresponding Cascade Delete rule in the database on the relationship between parent and child tables. This is the most effecient means for performing cascade deletes as the child rows don't need to be loaded into memory first. If you don't have a corresponding Cascade Delete rule in the database, ... (the located text continues this sentence)

Wouter de Kort  Oct 27, 2011 
PDF
Page 477
After Table 7-7

reads : $function=IsOf(‘MyModel.SavingsAccount’) and should read $filter=isof('MyModel.SavingsAccount')

Donaciano Rojas  Jul 17, 2011  Aug 12, 2011
PDF
Page 498
step 9

WRONG: "set the DataService generic parameter to NorthwindDataService" CORRECT: "set the DataService generic parameter to NorthwindEntities" btw, the core sample is correct, the typo is only in the step 9 text.

Note from the Author or Editor:
this is actually on page 478. Please change

Mikhail Strebkov  Aug 10, 2011  Aug 12, 2011
PDF
Page 554
C# Sample

private void mnuVerifySignature_Click( object sender, RoutedEventArgs e) { var data = "The quick brown fox jumped over the lazy dog."; var rsa = 24; // verify signature var cspParms = new CspParameters(rsa); cspParms.Flags = CspProviderFlags.UseMachineKeyStore; cspParms.KeyContainerName = "My Keys"; var algorithm = new RSACryptoServiceProvider(cspParms); var sourceBytes =new System.Text.UnicodeEncoding().GetBytes(data); //MISSING CODE signature = algorithm.SignData(sourceBytes, "SHA256"); var valid = algorithm.VerifyData(sourceBytes, "SHA256", signature); MessageBox.Show(valid.ToString()); }

Note from the Author or Editor:
the code works if the proper steps are followed. Here is a modified version with a comment. Visual Basic Private Sub mnuVerifySignature_Click( _ ByVal sender As System.Object, _ ByVal e As System.Windows.RoutedEventArgs) _ Handles mnuVerifySignature.Click If signature Is Nothing Then MessageBox.Show("Create signature first") Return End If Dim data = "The quick brown fox jumped over the lazy dog." Dim rsa = 24 ' verify signature Dim cspParms = New CspParameters(rsa) cspParms.Flags = CspProviderFlags.UseMachineKeyStore cspParms.KeyContainerName = "My Keys" Dim algorithm = New RSACryptoServiceProvider(cspParms) Dim sourceBytes() As Byte = _ New System.Text.UnicodeEncoding().GetBytes(data) 'be sure to sign the data first by 'using mnuSigitlSignature_Click above Dim valid = algorithm.VerifyData(sourceBytes, _ "SHA256", signature) MessageBox.Show(valid.ToString()) End Sub C# private void mnuVerifySignature_Click( object sender, RoutedEventArgs e) { var data = "The quick brown fox jumped over the lazy dog."; var rsa = 24; // verify signature var cspParms = new CspParameters(rsa); cspParms.Flags = CspProviderFlags.UseMachineKeyStore; cspParms.KeyContainerName = "My Keys"; var algorithm = new RSACryptoServiceProvider(cspParms); var sourceBytes = new System.Text.UnicodeEncoding().GetBytes(data); //be sure to sign the data first by //using mnuSigitlSignature_Click above var valid = algorithm.VerifyData(sourceBytes, "SHA256", signature); MessageBox.Show(valid.ToString()); }

Donaciano Rojas  Jul 22, 2011  Aug 12, 2011
Printed, PDF, Safari Books Online
Page 554
Last code sample from the bottom

The paragraph for "Encrypting Communications to SQL Server" states "you can set the TrustServerCertificate setting to true" The code sample shows "TrustServerCertificate=yes"

Note from the Author or Editor:
On page 554 Replace: you can set the TrustServerCertificate setting to true With: you can set the TrustServerCertificate setting to yes

Nick Spring  Jan 12, 2012 
Printed
Page 559
Question 2, A

Answer A should read RSACryptoServiceProvider Same with answers the page 619 where A is described as an asymmetric encryption algorithm

Note from the Author or Editor:
Page 559: Replace: A. RNGCryptoServiceProvider With: A. RSACryptoServiceProvider Page 619: Replace: A. Incorrect: RNGCryptoServiceProvider is an asymmetric algorithm. With: A. Incorrect: RSACryptoServiceProvider is an asymmetric algorithm.

None  Aug 25, 2011 
ePub, Mobi, Safari Books Online, Other Digital Version
Page 559
2nd question

Answer A has the wrong text - should be RSACryptoServiceProvider. Same change needed on page 619, too.

Note from the Author or Editor:
On page 559 and page 619, please locate RNGCryptoServiceProvider and change it to RSACryptoServiceProvider

Paul Vizard  Feb 29, 2012 
Printed
Page 608
VB and C# code

Number in Where clause does not match the case scenario. Where OrderAmount > 20000 should be Where OrderAmount > 1000

Note from the Author or Editor:
on page 608 and 609, locate the following (one occurance on each page): > 20000 replace with: > 1000

Frederic Hewitt  Aug 28, 2012