- Save 10% on selected children’s books, compliments of Amazon Family Promotion exclusive for Prime members .
ADO.NET Cookbook Paperback – 5 Oct 2003
Special offers and product promotions
Enter your mobile number or email address below and we'll send you a link to download the free Kindle App. Then you can start reading Kindle books on your smartphone, tablet, or computer - no Kindle device required.
To get the free app, enter your mobile phone number.
If you are a seller for this product, would you like to suggest updates through seller support?
About the Author
Bill Hamilton is a software architect specializing in designing, developing and implementing distributed applications using .NET and J2EE technologies. Over the last ten years, he has provided consulting services in B2B, B2C, B2E, data integration, and portal initiatives for banking, retail, accounting, manufacturing, and financial services. An early technology adopter, he frequently evaluates, recommends, and helps his clients use new technologies effectively. Bill has designed and helped build several award winning software packages. Bill is the co-author of O'Reilly's ADO.NET in a Nutshell and author of ADO.NET Cookbook.
Excerpt. © Reprinted by permission. All rights reserved.
Chapter 8 - Working with XML
ADO.NET and XML classes are tightly integrated in the .NET Framework. The DataSet can be filled with data or a schema from an XML stream or document. The DataSet can persist or serialize its data or schema to an XML stream or document. ADO synchronizes the DataSet with an XmlDataDocument. Data can be modified simultaneously using either class as needed; all changes made in one class are immediatelyreflected in the other class. This chapter focuses on XML support in ADO.NET and in SQL Server 2000.
The XML support in .NET is provided by integrated classes in five namespaces:
Contains classes that provide standards-based support for processing XML
Contains classes that provide standards-based support for XML Schema Definition (XSD) language schemas
Contains classes that serialize objects into XML documents or streams
Contains classes that parse and evaluate Xpath
Contains classes that support Extensible Stylesheet Language (XSL) transformations The DiffGram is an XML format that identifies current and original versions of data allowing the contents of a DataSet to be recreated accurately. The DiffGram allows you to identify the changes made to a DataSet since it was filled. The DataSet uses the DiffGram format to persist and to serialize its contents for transport across a network. Recipe 8.8 shows how to create a DiffGram of changes made to a DataSet.
SQL Server 2000 introduced support for retrieving the results of queries in XML format using the FOR XML clause. The XmlReader provides direct forward-only, read-only access to the XML result set stream from the SQL Server. Recipe 8.5 shows how to use the FOR XML clause to retrieve XML-format data from a SQL Server using an XmlReader.
The SQLXML managed classes expose SQLXML functionality that allows .NET applications to access XML data from SQL Server 2000, process the XML data, and update the SQL Server using an XML DiffGram representation of the data. SQLXML classes support template queries, an XML document containing one or more SQL queries or stored procedures, to execute. Recipe 8.10 shows how to use template queries.
OpenXML allows an XML document to be used in a SQL statement in the same way a table or view is used. Recipe 8.11 shows how to use OpenXML from ADO.NET.
8.1 Using XSD Schema Files to Load and Save a DataSet Structure
You need to create an XSD schema from a DataSet and define the schema of a DataSet from an XSD schema.
Use the XmlTextWriter and XmlTextReader classes.
The sample code contains three event handlers:
Creates a DataSet containing the Orders table and Order Details table from Northwind and a relation between the two. The XSD schema for the DataSet is written both to a file and to a text box on the form.
Creates a DataSet and reads in the schema from a file containing a previously serialized XSD schema. The XSD schema is written from the DataSet to a stream and displayed.
Clears the DataGrid and the result text box.
Most helpful customer reviews on Amazon.com
This book is riddled with code examples that leave out key components.
Example: Ch.7.7 - "Displaying Images from a Database in a Web Forms Control"
The code behind references Web Form objects that were never discussed. (Surprise!)
If you're looking for an abbreviated book on ADO.NET "Concepts", and don't really care about actually seeing working code, then this book is ok. If you need a concise guide, then don't bother. This book requires the reader to take a lot for granted.
One more thing that I really liked about this book. It has many examples that use namespaces outside of ADO.NET such as messaging, cryptography, serialization, XML manipulation, remoting, and Web services. This is helping me learn more about these topics (as well as ADO.NET) in this practical reference.
I would recommend this book to everyone - ADO.NET is such a fundamentally different approach to data access from Microsoft, that we will have to learn again from scratch, and this is the book to get the foundations right. I have found this to be invaluable in getting up and running with ADO.NET.
This book is THE MUST for applications that need large database interactions. This book acts as the bible to the ADO.Net techniques. Great work.
Look for similar items by category
- Books > Computing & Internet > Computer Science > Information Systems
- Books > Computing & Internet > Databases
- Books > Computing & Internet > Digital Lifestyle > Online Shopping > Amazon
- Books > Computing & Internet > Microsoft Windows
- Books > Computing & Internet > Programming > Languages
- Books > Computing & Internet > Programming > Languages & Tools
- Books > Computing & Internet > Programming > Microsoft Windows
- Books > Computing & Internet > Programming > Software Design, Testing & Engineering > Design Patterns