Programming Microsoft ADO.NET 2.0 Applications: Advanced Topics Comments and Corrections (905043)



The information in this article applies to:

  • Programming Microsoft ADO.NET 2.0 Applications: Advanced Topics, ISBN 0-7356-2141-1

SUMMARY

This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Programming Microsoft ADO.NET 2.0 Applications: Advanced Topics, ISBN 0-7356-2141-1.

The following topics are covered:

  • Page 6: dt.Rows.AcceptChanges( ) should be dt.AcceptChanges( )
  • Page 128: Sample code for fnGetGuidWhereClause

MORE INFORMATION

Page 6: dt.Rows.AcceptChanges( ) should be dt.AcceptChanges( )

On page 6, in Figure 1-2, the 6th item from the bottom of the page incorrectly states: dt.Rows.AcceptChanges( )

Change:
dt.Rows.AcceptChanges( )

To:
dt.AcceptChanges( )

Page 128: Sample code for fnGetGuidWhereClause

On page 128, under "Finding All Usages of a GUID in the Database", the source code for "SQL uspGetUsagesForId" refers to a function called fnGetGuidWhereClause, but the code for fnGetGuidWhereClause was inadvertently left out of the sample code. Listed below is the missing code for the function:
CREATE  function dbo.fnGetGuidWhereClause
(
 @TableName varchar(500),
 @Id uniqueidentifier
)
returns varchar(2000)
as
begin
 
DECLARE @currentColumn varchar(2000)
DECLARE @whereClause varchar(2000)
SET @whereClause = ' '
 DECLARE columns_cursor CURSOR
  FOR SELECT COLUMN_NAME 
  FROM information_schema.Columns 
  WHERE TABLE_NAME = @TableName AND DATA_TYPE='uniqueidentifier'
 OPEN columns_cursor
 FETCH NEXT FROM columns_cursor INTO @currentColumn
 WHILE @@FETCH_STATUS = 0
 BEGIN
  if(@whereClause) <> ' '
  BEGIN
   SET @whereClause = @whereClause + ' OR '
  END
  set @whereClause = @whereClause + @currentColumn + '=''' + convert(varchar(2000),@id) + ''''
  FETCH NEXT FROM columns_cursor INTO @currentColumn
 END
 CLOSE columns_cursor
 DEALLOCATE columns_cursor
  return @whereClause
end

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.

The print number of the book is located on the copyright page in the form of a string of numbers. For example: "2 3 4 5 6 7 8 0 QWT 9 8 76 5 4". The first number in the string is the the print number. In this example, the print number is 2.

Modification Type:MajorLast Reviewed:2/28/2006
Keywords:kbinfo kbdocfix kbdocerr KB905043 kbAudEndUser